diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-12-06 18:50:52 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-12-06 18:50:52 +0000 |
commit | 592d406208fb387fc14b5ec2663804d9f6a22a49 (patch) | |
tree | 5a263a9e5144956b18460f91a62880beaf9450fa /src/lib/Server/Plugins | |
parent | ccc99edf650eb11671792245efeb812a76ab0fd1 (diff) | |
download | bcfg2-592d406208fb387fc14b5ec2663804d9f6a22a49.tar.gz bcfg2-592d406208fb387fc14b5ec2663804d9f6a22a49.tar.bz2 bcfg2-592d406208fb387fc14b5ec2663804d9f6a22a49.zip |
Re-add daemonize support to the server
Fix some pylint errors
Add better error handling for function calls
Add mesh-mode support for sshbase
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1612 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r-- | src/lib/Server/Plugins/Cfg.py | 10 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Pkgmgr.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Plugins/SSHbase.py | 7 | ||||
-rw-r--r-- | src/lib/Server/Plugins/TCheetah.py | 7 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Vhost.py | 2 |
5 files changed, 17 insertions, 11 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py index c04c2e029..953401e7a 100644 --- a/src/lib/Server/Plugins/Cfg.py +++ b/src/lib/Server/Plugins/Cfg.py @@ -191,11 +191,13 @@ class ConfigFileEntry(object): [entry.attrib.__setitem__(x,y) for (x,y) in self.metadata.iteritems()] if self.paranoid: entry.attrib['paranoid'] = 'true' - try: - entry.text = filedata - except: + if entry.attrib['encoding'] == 'base64': entry.text = b2a_base64(filedata) - entry.attrib['encoding'] = 'base64' + else: + try: + entry.text = filedata + except: + syslog(LOG_ERR, "Failed to marshall file %s. Mark it as base64" % (entry.get('name'))) class Cfg(Plugin): '''This generator in the configuration file repository for bcfg2''' diff --git a/src/lib/Server/Plugins/Pkgmgr.py b/src/lib/Server/Plugins/Pkgmgr.py index f3b3aa144..5ce31750c 100644 --- a/src/lib/Server/Plugins/Pkgmgr.py +++ b/src/lib/Server/Plugins/Pkgmgr.py @@ -84,7 +84,7 @@ class Pkgmgr(Plugin): pkglist = self.pkgdir["%s.xml" % metadata.hostname] if pkglist.packages.has_key(pkgname): pkginfo = pkglist.packages[pkgname] - [entry.attrib.__setitem__(x, pkginfo[x]) for x in pkginfo] + [entry.attrib.__setitem__(field, pkginfo[field]) for field in pkginfo] return elif not self.pkgdir.entries.has_key("%s.xml" % metadata.image): self.LogError("Pkgmgr: no package index for image %s" % metadata.image) diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 1d378f1f2..cc93cc1c3 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -50,6 +50,13 @@ class SSHbase(Plugin): prefix + '/etc/ssh/ssh_host_key':self.build_hk, prefix + '/etc/ssh/ssh_host_key.pub':self.build_hk}} self.ipcache = {} + self.__rmi__ = ['GetPubKeys'] + + def GetPubKeys(self, client): + '''Export public key data''' + if not hasattr(self, 'static_skn'): + self.cache_skn() + return self.static_skn def get_ipcache_entry(self, client): '''build a cache of dns results''' diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index f39ebbad0..1ebdb6c94 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -60,11 +60,6 @@ class TCheetah(Plugin): '''Dispatch fetch calls to the correct object''' self.entries[entry.get('name')].BuildFile(entry, metadata) - def MapName(self, name): - '''MapName finds the object corresponding to a particular file - the DirShadow MapName method maps filenames literally''' - return name - def HandleEvent(self, event): '''Unified FAM event handler for DirShadow''' #print "got event %s %s %s" % ( event.code2str(), event.filename, event.requestID) @@ -72,7 +67,7 @@ class TCheetah(Plugin): if event.filename[0] == '/': return epath = "".join([self.data, self.handles[event.requestID], event.filename]) - identifier = self.MapName(epath[len(self.data):]) + identifier = epath[len(self.data):] if action in ['exists', 'created']: if isdir(epath): self.AddDirectoryMonitor(epath[len(self.data):]) diff --git a/src/lib/Server/Plugins/Vhost.py b/src/lib/Server/Plugins/Vhost.py index 43c1b8ca5..5c38cd19e 100644 --- a/src/lib/Server/Plugins/Vhost.py +++ b/src/lib/Server/Plugins/Vhost.py @@ -26,6 +26,7 @@ class VhostFile(SingleXMLFileBacked): sitesav = "/etc/apache2/sites-available/" def __init__(self, name, fam): + self.meta = Element('dummy') self.dispatch = {'ConfigFile':{'/etc/default/apache2':self.generateApacheDefault}, 'Service':{'apache2':self.generateApacheSvc}} SingleXMLFileBacked.__init__(self, name, fam) @@ -33,6 +34,7 @@ class VhostFile(SingleXMLFileBacked): self.servers = [] self.vhosts = {} + def Index(self): '''Build vhost data structures''' self.meta = XML(self.data) |