mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 07:18:28 +01:00
ssh: configure private key file
Fixes #1059 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -133,6 +133,7 @@ class Config(object):
|
||||
SECTION_REMOTE_URL = 'url'
|
||||
SECTION_REMOTE_USER = 'user'
|
||||
SECTION_REMOTE_PORT = 'port'
|
||||
SECTION_REMOTE_KEY_FILE = 'keyfile'
|
||||
SECTION_REMOTE_SCHEMA = {
|
||||
SECTION_REMOTE_URL: And(supported_url, error="Unsupported URL"),
|
||||
Optional(SECTION_AWS_REGION): str,
|
||||
@@ -143,6 +144,7 @@ class Config(object):
|
||||
Optional(SECTION_CACHE_TYPE): SECTION_CACHE_TYPE_SCHEMA,
|
||||
Optional(SECTION_REMOTE_USER): str,
|
||||
Optional(SECTION_REMOTE_PORT): int,
|
||||
Optional(SECTION_REMOTE_KEY_FILE): str,
|
||||
}
|
||||
|
||||
SCHEMA = {
|
||||
|
||||
+5
-1
@@ -58,6 +58,7 @@ class RemoteSSH(RemoteBase):
|
||||
getpass.getuser())
|
||||
self.prefix = self.group('path')
|
||||
self.port = config.get(Config.SECTION_REMOTE_PORT, self.DEFAULT_PORT)
|
||||
self.keyfile = config.get(Config.SECTION_REMOTE_KEY_FILE, None)
|
||||
|
||||
def md5s_to_path_infos(self, md5s):
|
||||
return [{'scheme': 'ssh',
|
||||
@@ -77,7 +78,10 @@ class RemoteSSH(RemoteBase):
|
||||
ssh.load_system_host_keys()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
||||
ssh.connect(host, username=user, port=port)
|
||||
ssh.connect(host,
|
||||
username=user,
|
||||
port=port,
|
||||
key_filename=self.keyfile)
|
||||
|
||||
return ssh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user