Skip to content

Commit 62af2bb

Browse files
authored
Merge pull request #2846 from shehzaman/feature/missing-identity-file
Put back identityfile parameter from .ssh/config
2 parents 5705d12 + 8da03e0 commit 62af2bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docker/transport/sshconn.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,18 @@ def _create_paramiko_client(self, base_url):
202202
with open(ssh_config_file) as f:
203203
conf.parse(f)
204204
host_config = conf.lookup(base_url.hostname)
205-
self.ssh_conf = host_config
206205
if 'proxycommand' in host_config:
207206
self.ssh_params["sock"] = paramiko.ProxyCommand(
208207
self.ssh_conf['proxycommand']
209208
)
210209
if 'hostname' in host_config:
211210
self.ssh_params['hostname'] = host_config['hostname']
212211
if base_url.port is None and 'port' in host_config:
213-
self.ssh_params['port'] = self.ssh_conf['port']
212+
self.ssh_params['port'] = host_config['port']
214213
if base_url.username is None and 'user' in host_config:
215-
self.ssh_params['username'] = self.ssh_conf['user']
214+
self.ssh_params['username'] = host_config['user']
215+
if 'identityfile' in host_config:
216+
self.ssh_params['key_filename'] = host_config['identityfile']
216217

217218
self.ssh_client.load_system_host_keys()
218219
self.ssh_client.set_missing_host_key_policy(paramiko.WarningPolicy())

0 commit comments

Comments
 (0)