Skip to content

Commit

Permalink
Merge 3e94fc8 into d8a71fc
Browse files Browse the repository at this point in the history
  • Loading branch information
lndbrg committed Aug 19, 2014
2 parents d8a71fc + 3e94fc8 commit 625df6a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions paramiko/config.py
Expand Up @@ -56,7 +56,7 @@ def parse(self, file_obj):
host = {"host": ['*'], "config": {}}
for line in file_obj:
line = line.rstrip('\n').lstrip()
if (line == '') or (line[0] == '#'):
if not line or line.startswith('#'):
continue
if '=' in line:
# Ensure ProxyCommand gets properly split
Expand All @@ -83,14 +83,14 @@ def parse(self, file_obj):
#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.

elif key in ['identityfile', 'localforward', 'remoteforward']:
if key in host['config']:
host['config'][key].append(value)
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):
Expand All @@ -112,7 +112,7 @@ def lookup(self, hostname):
:param str hostname: the hostname to lookup
"""
matches = [config for config in self._config if
self._allowed(hostname, config['host'])]
self._allowed(config['host'], hostname)]

ret = {}
for match in matches:
Expand All @@ -128,7 +128,7 @@ def lookup(self, hostname):
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:]):
Expand Down

0 comments on commit 625df6a

Please sign in to comment.