diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2019-09-30 14:18:31 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2019-09-30 14:29:37 -0400 |
commit | 72f51229e8752cd368c4b8434f64885b40cf4fe6 (patch) | |
tree | 13d100cb1cae0c72dc99cf94897e419fcaf2cebb | |
parent | fab7b20c5ea9521af0bd677479d03a85b39dbb93 (diff) | |
download | paramiko-72f51229e8752cd368c4b8434f64885b40cf4fe6.tar.gz |
Comment current parse flow
-rw-r--r-- | paramiko/config.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/paramiko/config.py b/paramiko/config.py index fb761248..00f6599a 100644 --- a/paramiko/config.py +++ b/paramiko/config.py @@ -110,23 +110,28 @@ class SSHConfig(object): # Strip any leading or trailing whitespace from the line. # Refer to https://github.com/paramiko/paramiko/issues/499 line = line.strip() + # Skip blanks, comments if not line or line.startswith("#"): continue + # Parse line into key, value match = re.match(self.SETTINGS_REGEX, line) if not match: raise Exception("Unparsable line {}".format(line)) key = match.group(1).lower() value = match.group(2) + # Host keyword triggers switch to new block/context if key == "host": self._config.append(host) host = {"host": self._get_hosts(value), "config": {}} + # Special-case for noop ProxyCommands elif key == "proxycommand" and value.lower() == "none": # 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 + # All other keywords get stored, directly or via append else: if value.startswith('"') and value.endswith('"'): value = value[1:-1] @@ -141,6 +146,7 @@ class SSHConfig(object): host["config"][key] = [value] elif key not in host["config"]: host["config"][key] = value + # Store last 'open' block and we're done self._config.append(host) def lookup(self, hostname): |