diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2014-08-26 12:50:54 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-08-26 12:50:54 -0700 |
commit | b0ed52f67c9b875dd29579d12bab64a45308405b (patch) | |
tree | baf511cf58293f4966da4f92fcbf0bb6d30bca92 | |
parent | e7e4ab3f8e44b88eaed494a911ef9ef4204cc415 (diff) | |
parent | 8dfc2b79cbf86e8e5fce4b7a6cedf9c4b5be706d (diff) |
Merge branch '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 ebccc72d..24679d5f 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. * :support:`249` Consolidate version information into one spot. Thanks to Gabi Davar for the reminder. * :release:`1.14.1 <2014-08-25>` |