Skip to content

Commit 303ba30

Browse files
committed
ENH: Now the case when there is no SSH forwarding is well handled
1 parent 33d9217 commit 303ba30

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

nipype/interfaces/io.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,11 +1766,14 @@ def _get_ssh_client(self):
17661766
config = paramiko.SSHConfig()
17671767
config.parse(open(os.path.expanduser('~/.ssh/config')))
17681768
host = config.lookup(self.inputs.hostname)
1769-
proxy = paramiko.ProxyCommand(
1770-
subprocess.check_output(
1771-
[os.environ['SHELL'], '-c', 'echo %s' % host['proxycommand']]
1772-
).strip()
1773-
)
1769+
if 'proxycommand' in host:
1770+
proxy = paramiko.ProxyCommand(
1771+
subprocess.check_output(
1772+
[os.environ['SHELL'], '-c', 'echo %s' % host['proxycommand']]
1773+
).strip()
1774+
)
1775+
else:
1776+
proxy = None
17741777
client = paramiko.SSHClient()
17751778
client.load_system_host_keys()
17761779
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

0 commit comments

Comments
 (0)