diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-09-23 16:49:00 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-09-23 16:49:00 +0000 |
commit | ca2118c81356b9b39845cd36cb9b61b0af1e03b9 (patch) | |
tree | 3406218d50b198b67818670fdd9ff60a840d67df /src/lib/Server/Plugins/SSHbase.py | |
parent | dc5458245104b6959da15ee618ede0cc6ef85ae9 (diff) | |
download | bcfg2-ca2118c81356b9b39845cd36cb9b61b0af1e03b9.tar.gz bcfg2-ca2118c81356b9b39845cd36cb9b61b0af1e03b9.tar.bz2 bcfg2-ca2118c81356b9b39845cd36cb9b61b0af1e03b9.zip |
commit changes from indiana
(Logical change 1.318)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1297 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/SSHbase.py')
-rw-r--r-- | src/lib/Server/Plugins/SSHbase.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 4fc670dea..845ce28eb 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -2,7 +2,7 @@ __revision__ = '$Revision$' from binascii import b2a_base64 -from os import rename, system +from os import rename, system, popen from socket import gethostbyname, gaierror from Bcfg2.Server.Plugin import Plugin, DirectoryBacked @@ -38,7 +38,7 @@ class SSHbase(Plugin): Plugin.__init__(self, core, datastore) self.repository = DirectoryBacked(self.data, self.core.fam) try: - prefix = open("%s/%s" % (self.data, prefix)).read().strip() + prefix = open("%s/prefix" % (self.data)).read().strip() except IOError: prefix = '' self.Entries = {'ConfigFile': @@ -59,7 +59,7 @@ class SSHbase(Plugin): else: # need to add entry if self.repository.entries.has_key('domains'): - domains = self.repository.entries['domains'].split() + domains = self.repository.entries['domains'].data.split() else: domains = self.domains for domain in domains: @@ -70,6 +70,14 @@ class SSHbase(Plugin): return (ipaddr, fqdn) except gaierror: continue + if len(domains) == 1: + domain = domains[0] + fqdn = "%s.%s" % (client, domain) + data = popen("getent hosts %s" % (client)).read().strip().split() + if data: + return (data[0], fqdn) + else: + continue self.LogError("Failed to find fqdn for %s" % client) raise gaierror |