summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2003-12-29 03:52:16 +0000
committerNarayan Desai <desai@mcs.anl.gov>2003-12-29 03:52:16 +0000
commitbe2082bfbb736a5a3b281c605e65489b56c2a108 (patch)
tree870a22f84c96c09f3d94c241e424d11460b0283c /src
parent0e049f5adc2985db16b2db9446f1bda8468c04e5 (diff)
downloadbcfg2-be2082bfbb736a5a3b281c605e65489b56c2a108.tar.gz
bcfg2-be2082bfbb736a5a3b281c605e65489b56c2a108.tar.bz2
bcfg2-be2082bfbb736a5a3b281c605e65489b56c2a108.zip
minor fixups
2003/12/28 20:45:16-06:00 (none)!desai minor bugfix 2003/12/28 20:40:55-06:00 (none)!desai minor updates 2003/12/23 16:16:05-06:00 (none)!desai $Id$ -> $Revision$ 2003/12/23 16:14:43-06:00 (none)!desai fix version (Logical change 1.7) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@25 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/sshbase.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/sshbase.py b/src/sshbase.py
index 14ddb45c0..5ab69a015 100644
--- a/src/sshbase.py
+++ b/src/sshbase.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from glob import glob
-from os import rename
+from os import rename, stat
from socket import gethostbyname
from Types import ConfigFile
@@ -9,23 +9,25 @@ from Generator import Generator
class sshbase(Generator):
__name__ = 'sshbase'
- __version__ = '$Id: $'
+ __version__ = '$Id$'
__author__ = 'bcfg-dev@mcs.anl.gov'
+ __build__ = { '/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'}
- __build__ = { '/etc/ssh/ssh_known_hosts':build_skn,
- '/etc/ssh/ssh_host_key':build_hk}
-
def build_skn(self,name,client):
data=file("%s/ssh_known_hosts"%(self.data)).read()
ip=gethostbyname(client)
for hostkey in ["ssh_host_dsa_key.pub.H_%s","ssh_host_rsa_key.pub.H_%s","ssh_host_key.pub.H_%s"]:
filename="%s/%s"%(self.data,hostkey)%(client)
hdata=file(filename).read()
- data+="%s,%s,%s %s"%(client,"%.mcs.anl.gov"%(client),ip,hdata)
+ data+="%s,%s,%s %s"%(client,"%s.mcs.anl.gov"%(client),ip,hdata)
return ConfigFile(name,'root','root','0644',data)
def build_hk(self,name,client):
- reponame="%s/%s.H_%s"%(self.__data__,name.split('/')[-1],client)
+ reponame="%s/%s.H_%s"%(self.data,name.split('/')[-1],client)
try:
stat(reponame)
except IOError:
@@ -61,3 +63,4 @@ class sshbase(Generator):
system('ssh-keygen -f %s -N "" -t %s -C root@%s'%(filename,keytype,client))
rename("%s.pub"%(filename),".".join(filename.split('.')[:-1]+['pub']+filename.split('.')[-1]))
# call the notifier for global
+