diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2016-04-25 18:33:33 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2016-04-25 18:33:33 -0700 |
commit | 1a92ef5cf9a97a5dcdf96fdfa69ad0900b9dec87 (patch) | |
tree | 29af2f4a130a4b944fba86c236905232f8d4ea4d /paramiko/config.py | |
parent | 1163fd91e31f280d7b1c4857529fe8314c61fdd5 (diff) | |
download | paramiko-1a92ef5cf9a97a5dcdf96fdfa69ad0900b9dec87.tar.gz |
Test & implementation for part 1 re: #670
Diffstat (limited to 'paramiko/config.py')
-rw-r--r-- | paramiko/config.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/paramiko/config.py b/paramiko/config.py index e18fa4bf..7374eb1a 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -76,15 +76,17 @@ class SSHConfig (object): 'config': {} } elif key == 'proxycommand' and value.lower() == 'none': - # Proxycommands of none should not be added as an actual value. (Issue #415) - continue + # Store 'none' as None; prior to 3.x, it will get stripped out + # at the end (for compatibility with issue #415). After 3.x, it + # will simply not get stripped, leaving a nice explicit marker. + host['config'][key] = None else: if value.startswith('"') and value.endswith('"'): value = value[1:-1] - #identityfile, localforward, remoteforward keys are special cases, since they are allowed to be - # specified multiple times and they should be tried in order - # of specification. + # identityfile, localforward, remoteforward keys are special + # cases, since they are allowed to be specified multiple times + # and they should be tried in order of specification. if key in ['identityfile', 'localforward', 'remoteforward']: if key in host['config']: host['config'][key].append(value) @@ -127,10 +129,13 @@ class SSHConfig (object): # else it will reference the original list # in self._config and update that value too # when the extend() is being called. - ret[key] = value[:] + ret[key] = value[:] if value is not None else value elif key == 'identityfile': ret[key].extend(value) ret = self._expand_variables(ret, hostname) + # TODO: remove in 3.x re #670 + if 'proxycommand' in ret and ret['proxycommand'] is None: + del ret['proxycommand'] return ret def get_hostnames(self): @@ -211,6 +216,8 @@ class SSHConfig (object): } for k in config: + if config[k] is None: + continue if k in replacements: for find, replace in replacements[k]: if isinstance(config[k], list): |