[Da-tools-commits] ./da-tools/userdir-ldap-sshkeys r360: make behaviour backwards compatible with respect to the single/multiple ssh keyfiles options
Mark Hymers
mark at hymers.org.uk
Wed Dec 26 21:23:49 UTC 2007
------------------------------------------------------------
revno: 360
committer: Mark Hymers <mark at hymers.org.uk>
branch nick: userdir-ldap-common-sshkeys
timestamp: Wed 2007-12-26 21:23:49 +0000
message:
make behaviour backwards compatible with respect to the single/multiple ssh keyfiles options
modified:
ud-generate
userdir-ldap.conf
userdir_ldap.py
-------------- next part --------------
=== modified file 'ud-generate'
--- a/ud-generate 2007-12-26 20:52:01 +0000
+++ b/ud-generate 2007-12-26 21:23:49 +0000
@@ -178,12 +178,12 @@
files = []
# Depending on config, we write out either a single file,
# multiple files, or both
- if ConfModule.singlesshfile is True:
+ if SingleSSHFile:
try:
OldMask = os.umask(0077);
- masterFile = open(File + ".tmp","w",0600);
+ masterFile = open(masterFileName + ".tmp","w",0600);
os.umask(OldMask);
- except:
+ except IOError:
Die(masterFileName,masterFile,None)
raise
@@ -206,35 +206,35 @@
F = None;
try:
- if ConfModule.multiplesshfiles is True:
+ if MultipleSSHFiles:
OldMask = os.umask(0077);
File = masterFileName + "-" + User
F = open(File + ".tmp","w",0600);
os.umask(OldMask);
for I in x[1]["sshRSAAuthKey"]:
- if ConfModule.multiplesshfiles is True:
+ if MultipleSSHFiles:
MultipleLine = "%s" % I
MultipleLine = Sanitize(MultipleLine) + "\n"
F.write(MultipleLine)
- if ConfModule.singlesshfile is True:
+ if SingleSSHFile:
SingleLine = "%s: %s" % (User, I)
SingleLine = Sanitize(SingleLine) + "\n"
masterFile.write(SingleLine)
- if ConfModule.multiplesshfiles is True:
+ if MulipleSSHFiles:
Done(File,F,None);
- files.append(File)
+ files.append(os.path.basename(File))
# Oops, something unspeakable happened.
- except:
+ except IOError:
Die(File,F,None)
Die(masterFileName,masterFile,None)
raise;
- if ConfModule.singlesshfile is True:
+ if SingleSSHFile:
Done(masterFileName,masterFile,None)
- files.append(masterFileName)
+ files.append(os.path.basename(masterFileName))
return files
=== modified file 'userdir-ldap.conf'
--- a/userdir-ldap.conf 2007-12-26 14:01:40 +0000
+++ b/userdir-ldap.conf 2007-12-26 21:23:49 +0000
@@ -30,7 +30,7 @@
generateconf = "/etc/userdir-ldap/generate.conf"
generatedir = "/var/cache/userdir-ldap/hosts/";
singlesshfile = True
-multiplesshfiles = True
+multiplesshfiles = False
passdir = "/etc/userdir-ldap/";
# GPG Things
=== modified file 'userdir_ldap.py'
--- a/userdir_ldap.py 2007-12-26 20:49:42 +0000
+++ b/userdir_ldap.py 2007-12-26 21:23:49 +0000
@@ -41,6 +41,10 @@
Ech_ErrorLog = ConfModule.ech_errorlog;
Ech_MainLog = ConfModule.ech_mainlog;
+# For backwards compatibility, we default to the old behaviour
+MultipleSSHFiles = getattr(ConfModule, 'multiplesshfiles', False)
+SingleSSHFile = getattr(ConfModule, 'singlesshfile', True)
+
# Break up the keyring list
userdir_gpg.SetKeyrings(ConfModule.keyrings.split(":"))
More information about the Da-tools-commits
mailing list