DVC import doesn't use config.local
Bug Report
Bug reproducibility
Have a DVC repository which import (dvc import) another folder.
Then, on another machine, try to clone/pull the repository (cache included) with a ssh. (Sadly, dvc -vvv doesn't provide much relevant information, like where the temporary git clone is located). However, it does show that the username for the connection of the ssh is not replaced to the provided and overridden in the mother config.local nor config. Because of that, the imported repository can't access securely to the remote location, even though these settings could be overridden in another config file.
Please provide information about your setup
Output of dvc version:
$dvc -V
1.9.1
Additional Information (if any): Both the cache and the core are on the same ssh server (though different folders). They requires a user/password to access, which are provided in the cache.local.
The trace with the authentification problem shows as:
2020-11-06 19:15:18,736 DEBUG: Establishing ssh connection with 'myserver.com' through port '22' as user 'nobody'
2020-11-06 19:15:22,527 TRACE: SELECT count from state_info WHERE rowid=?
2020-11-06 19:15:22,527 DEBUG: fetched: [(0,)]
2020-11-06 19:15:22,529 TRACE: UPDATE state_info SET count = ? WHERE rowid = ?
2020-11-06 19:15:22,531 ERROR: unexpected error - Authentication failed.
------------------------------------------------------------
Traceback (most recent call last):
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/pool.py", line 51, in get_connection
return self._conns.popleft()
IndexError: pop from an empty deque
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/main.py", line 76, in main
ret = cmd.run()
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/command/data_sync.py", line 36, in run
run_cache=self.args.run_cache,
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/repo/__init__.py", line 54, in wrapper
return f(repo, *args, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/repo/pull.py", line 34, in pull
run_cache=run_cache,
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/repo/__init__.py", line 54, in wrapper
return f(repo, *args, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/repo/fetch.py", line 70, in fetch
d, f = _fetch_external(self, repo_url, repo_rev, files, jobs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/repo/fetch.py", line 89, in _fetch_external
d, f, _ = repo.fetch_external(files, jobs=jobs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/external_repo.py", line 176, in fetch_external
path, repo, download_update, **kwargs
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/external_repo.py", line 140, in _fetch_to_cache
path_info, download_callback=callback, **kwargs
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 39, in wrapper
return deco(call, *dargs, **dkwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/base.py", line 45, in use_state
return call()
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 60, in __call__
return self._func(*self._args, **self._kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/base.py", line 271, in get_hash
hash_info = self.get_dir_hash(path_info, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/repo.py", line 377, in get_dir_hash
return super().get_dir_hash(path_info, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 39, in wrapper
return deco(call, *dargs, **dkwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/base.py", line 45, in use_state
return call()
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 60, in __call__
return self._func(*self._args, **self._kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/base.py", line 339, in get_dir_hash
dir_info = self._collect_dir(path_info, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/base.py", line 309, in _collect_dir
for fname in self.walk_files(path_info, **kwargs):
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/repo.py", line 370, in walk_files
for root, _, files in self.walk(top, **kwargs):
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/repo.py", line 367, in walk
yield from self._walk(repo_walk, dvc_walk, dvcfiles=dvcfiles)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/repo.py", line 315, in _walk
yield from self._dvc_walk(dvc_walk)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/repo.py", line 248, in _dvc_walk
root, dirs, files = next(walk)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/dvc.py", line 227, in walk
yield from self._walk(root, trie, topdown=topdown, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/dvc.py", line 201, in _walk
yield from self._walk(root / dname, trie)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/dvc.py", line 182, in _walk
self._add_dir(root, trie, out, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/dvc.py", line 167, in _add_dir
self._fetch_dir(out, filter_info=top, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/dvc.py", line 154, in _fetch_dir
out.get_dir_cache(**kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/output/base.py", line 396, in get_dir_cache
**kwargs,
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/data_cloud.py", line 85, in pull
cache, jobs=jobs, remote=remote, show_checksums=show_checksums
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 39, in wrapper
return deco(call, *dargs, **dkwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/cache/base.py", line 50, in use_state
return call()
File "/snap/dvc/942/lib/python3.6/site-packages/funcy/decorators.py", line 60, in __call__
return self._func(*self._args, **self._kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/remote/base.py", line 15, in wrapper
return f(obj, named_cache, remote, *args, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/cache/local.py", line 443, in pull
download=True,
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/cache/local.py", line 327, in _process
download=download,
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/cache/local.py", line 171, in _status
md5s, jobs=jobs, name=str(remote.tree.path_info)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/remote/ssh.py", line 72, in hashes_exist
ret = list(itertools.compress(hashes, in_remote))
File "/snap/dvc/942/usr/lib/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
yield fs.pop().result()
File "/snap/dvc/942/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/snap/dvc/942/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/snap/dvc/942/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/remote/ssh.py", line 63, in exists_with_progress
return self.batch_exists(chunks, callback=pbar.update_msg)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/remote/ssh.py", line 30, in batch_exists
with self.tree.ssh(path_infos[0]) as ssh:
File "/snap/dvc/942/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/pool.py", line 11, in get_connection
conn = pool.get_connection()
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/pool.py", line 53, in get_connection
return self._conn_func(*self._conn_args, **self._conn_kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/dvc/tree/ssh/connection.py", line 57, in __init__
self._ssh.connect(host, *args, **kwargs)
File "/snap/dvc/942/lib/python3.6/site-packages/paramiko/client.py", line 446, in connect
passphrase,
File "/snap/dvc/942/lib/python3.6/site-packages/paramiko/client.py", line 764, in _auth
raise saved_exception
File "/snap/dvc/942/lib/python3.6/site-packages/paramiko/client.py", line 751, in _auth
self._transport.auth_password(username, password)
File "/snap/dvc/942/lib/python3.6/site-packages/paramiko/transport.py", line 1509, in auth_password
return self.auth_handler.wait_for_response(my_event)
File "/snap/dvc/942/lib/python3.6/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
------------------------------------------------------------
2020-11-06 19:15:23,386 DEBUG: Version info for developers:
DVC version: 1.9.1 (snap)
---------------------------------
Platform: Python 3.6.9 on Linux-4.15.0-55-generic-x86_64-with-Ubuntu-18.04-bionic
Supports: All remotes
Cache types: <https://error.dvc.org/no-dvc-cache>
Repo: dvc, git
Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2020-11-06 19:15:23,388 DEBUG: Analytics is enabled.
2020-11-06 19:15:23,438 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmppjq_p_19']'
2020-11-06 19:15:23,439 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmppjq_p_19']'
Obviously, the "nobody" user should be replaced with the relevant username in the config.local, but is not.
I can however properly login myself to the ssh server, on the same machine, using the credentials.
Hi, @dmidge8. DVC does not use the host's config when importing/get, it just uses the config from the "importing" repo.
We have an open issue for supporting --remote args: #2466 for get/import, but for now, it might be possible to set the config
using dvc config --global as a workaround.
I'm closing this as duplicate of #2466.