summaryrefslogtreecommitdiff
path: root/paramiko/config.py
diff options
context:
space:
mode:
authorSøren Løvborg <soeren.j.loevborg@siemens.com>2014-09-19 15:00:18 +0200
committerSøren Løvborg <soeren.j.loevborg@siemens.com>2014-09-19 15:00:18 +0200
commit8e2d4321509cf942c3d499b643b1978b1addaebf (patch)
tree2a698fb54a51171ef20e930777b312ab6126f2e1 /paramiko/config.py
parent5b832842f1390dddcd45c2a891c53e3482474979 (diff)
downloadparamiko-8e2d4321509cf942c3d499b643b1978b1addaebf.tar.gz
SSHConfig.get_hostnames: List literal hostnames from SSH config
Diffstat (limited to 'paramiko/config.py')
-rw-r--r--paramiko/config.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/paramiko/config.py b/paramiko/config.py
index 20ca4aa7..4972c27b 100644
--- a/paramiko/config.py
+++ b/paramiko/config.py
@@ -126,6 +126,16 @@ class SSHConfig (object):
ret = self._expand_variables(ret, hostname)
return ret
+ def get_hostnames(self):
+ """
+ Return the set of literal hostnames defined in the SSH config (both
+ explicit hostnames and wildcard entries).
+ """
+ hosts = set()
+ for entry in self._config:
+ hosts.update(entry['host'])
+ return hosts
+
def _allowed(self, hosts, hostname):
match = False
for host in hosts: