summaryrefslogtreecommitdiffstats
path: root/generators
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-06-09 18:36:20 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-06-09 18:36:20 +0000
commitf129fdca2b322314e911992c0f037a4cde8edb8a (patch)
tree5b5658b9b18b10a472ee084a97fa13430ac4f71c /generators
parent38cabbcb8c089002fbd5e5759fee5fffb0cf44e9 (diff)
downloadbcfg2-f129fdca2b322314e911992c0f037a4cde8edb8a.tar.gz
bcfg2-f129fdca2b322314e911992c0f037a4cde8edb8a.tar.bz2
bcfg2-f129fdca2b322314e911992c0f037a4cde8edb8a.zip
update to new API
2004/06/08 09:50:38-05:00 anl.gov!desai update to use metadata argument for generators (Logical change 1.21) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@87 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'generators')
-rw-r--r--generators/sshbase.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/generators/sshbase.py b/generators/sshbase.py
index c41ab16ae..006eda31e 100644
--- a/generators/sshbase.py
+++ b/generators/sshbase.py
@@ -12,24 +12,26 @@ class sshbase(Generator):
__name__ = 'sshbase'
__version__ = '$Id$'
__author__ = 'bcfg-dev@mcs.anl.gov'
- __provides__ = {'ConfigFile':{'/etc/ssh/ssh_known_hosts':'build_skn',
- '/etc/ssh/ssh_host_dsa_key':'build_hk',
- '/etc/ssh/ssh_host_rsa_key':'build_hk',
- '/etc/ssh/ssh_host_dsa_key.pub':'build_hk',
- '/etc/ssh/ssh_host_rsa_key.pub':'build_hk'}}
def __setup__(self):
self.repository = DirectoryBacked(self.data, self.core.fam)
+ self.__provides__ = {'ConfigFile':{'/etc/ssh/ssh_known_hosts':self.build_skn,
+ '/etc/ssh/ssh_host_dsa_key':self.build_hk,
+ '/etc/ssh/ssh_host_rsa_key':self.build_hk,
+ '/etc/ssh/ssh_host_dsa_key.pub':self.build_hk,
+ '/etc/ssh/ssh_host_rsa_key.pub':self.build_hk}}
- def build_skn(self,name,client):
+ def build_skn(self,name,metadata):
+ client = metadata.hostname
filedata = self.repository.entries['ssh_known_hosts'].data
ip=gethostbyname(client)
- keylist = map(lambda x:x%client, ["ssh_host_dsa_key.pub.H_%s","ssh_host_rsa_key.pub.H_%s","ssh_host_key.pub.H_%s"])
+ keylist = map(lambda x:x%(client), ["ssh_host_dsa_key.pub.H_%s","ssh_host_rsa_key.pub.H_%s","ssh_host_key.pub.H_%s"])
for hostkey in keylist:
filedata += "%s,%s,%s %s"%(client,"%s.mcs.anl.gov"%(client),ip,self.repository.entries[hostkey].data)
return ConfigFile(name,'root','root','0644',filedata)
- def build_hk(self,name,client):
+ def build_hk(self,name,metadata):
+ client = metadata.hostname
filename = "%s.H_%s"%(name.split('/')[-1],client)
if filename not in self.repository.entries.keys():
self.GenerateHostKeys(client)