Skip to content

Commit

Permalink
Improving SSH configuration defaults (#4055)
Browse files Browse the repository at this point in the history
 * `look_for_keys` is now set to `True` by default, which is also
   paramiko's default
 * `allow_agent` is now set to `True` by default (on the shell, if you
   have an SSH agent, you expect that it is automatically used by ssh)
 * If an empty string is passed as the key_filename, this is not passed
   to paramiko, so it will search for it rather than complaining that
   file `''` does not exist.
  • Loading branch information
giovannipizzi authored May 6, 2020
1 parent d39ec6a commit a038876
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aiida/transports/plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ def _get_allow_agent_suggestion_string(cls, computer):
Return a suggestion for the specific field.
"""
config = parse_sshconfig(computer.hostname)
return convert_to_bool(str(config.get('allow_agent', 'no')))
return convert_to_bool(str(config.get('allow_agent', 'yes')))

@classmethod
def _get_look_for_keys_suggestion_string(cls, computer):
"""
Return a suggestion for the specific field.
"""
config = parse_sshconfig(computer.hostname)
return convert_to_bool(str(config.get('look_for_keys', 'no')))
return convert_to_bool(str(config.get('look_for_keys', 'yes')))

@classmethod
def _get_proxy_command_suggestion_string(cls, computer):
Expand Down Expand Up @@ -405,6 +405,8 @@ def open(self):
raise InvalidOperation('Cannot open the transport twice')
# Open a SSHClient
connection_arguments = self._connect_args
if 'key_filename' in connection_arguments and not connection_arguments['key_filename']:
connection_arguments.pop('key_filename')
proxystring = connection_arguments.pop('proxy_command', None)
if proxystring:
self._proxy = _DetachedProxyCommand(proxystring)
Expand Down

0 comments on commit a038876

Please sign in to comment.