File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,15 @@ def read_openssh_config(_host, config_file=None):
7070 hostname, user, port and private key values
7171
7272 :param _host: Hostname to lookup in config"""
73- ssh_config = SSHConfig ()
7473 _ssh_config_file = config_file if config_file else \
7574 os .path .sep .join ([os .path .expanduser ('~' ),
7675 '.ssh' , 'config' ])
7776 # Load ~/.ssh/config if it exists to pick up username
7877 # and host address if set
79- if os .path .isfile (_ssh_config_file ):
80- ssh_config .parse (open (_ssh_config_file ))
78+ if not os .path .isfile (_ssh_config_file ):
79+ return
80+ ssh_config = SSHConfig ()
81+ ssh_config .parse (open (_ssh_config_file ))
8182 host_config = ssh_config .lookup (_host )
8283 host = (host_config ['hostname' ] if
8384 'hostname' in host_config
You can’t perform that action at this time.
0 commit comments