diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2014-08-26 12:50:30 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-08-26 12:50:30 -0700 |
commit | 8dfc2b79cbf86e8e5fce4b7a6cedf9c4b5be706d (patch) | |
tree | 9b71f5c776e893ca2566bc555a5b30903545aef3 | |
parent | 12cc48839c607fe51e4b3c672bb91594725d2747 (diff) | |
parent | b641c69a80e2bd4737c636e7edd0918d6753c3d0 (diff) |
Merge branch '1.13' into 1.14
Conflicts:
sites/www/changelog.rst
-rw-r--r-- | paramiko/config.py | 12 | ||||
-rw-r--r-- | sites/www/changelog.rst | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/paramiko/config.py b/paramiko/config.py index 96ec9ef7..30e000e7 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -56,7 +56,7 @@ class SSHConfig (object): host = {"host": ['*'], "config": {}} for line in file_obj: line = line.rstrip('\r\n').lstrip() - if (line == '') or (line[0] == '#'): + if not line or line.startswith('#'): continue if '=' in line: # Ensure ProxyCommand gets properly split @@ -90,7 +90,7 @@ class SSHConfig (object): else: host['config'][key] = [value] elif key not in host['config']: - host['config'].update({key: value}) + host['config'][key] = value self._config.append(host) def lookup(self, hostname): @@ -111,8 +111,10 @@ class SSHConfig (object): :param str hostname: the hostname to lookup """ - matches = [config for config in self._config if - self._allowed(hostname, config['host'])] + matches = [ + config for config in self._config + if self._allowed(config['host'], hostname) + ] ret = {} for match in matches: @@ -128,7 +130,7 @@ class SSHConfig (object): ret = self._expand_variables(ret, hostname) return ret - def _allowed(self, hostname, hosts): + def _allowed(self, hosts, hostname): match = False for host in hosts: if host.startswith('!') and fnmatch.fnmatch(hostname, host[1:]): diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 0bed707b..426a9ee3 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,8 @@ Changelog ========= +* :support:`378 backported` Minor code cleanup in the SSH config module + courtesy of Olle Lundberg. * :release:`1.14.1 <2014-08-25>` * :release:`1.13.2 <2014-08-25>` * :bug:`376` Be less aggressive about expanding variables in ``ssh_config`` |