diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-05-22 19:05:37 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-05-22 19:05:37 +0000 |
commit | 471b5bf0d417a2847d40aee33652ca6d22dd964d (patch) | |
tree | 3049d0d31772a6876f187f749ea67255f824aa2b /src | |
parent | c44b5dec67211bcf1c9dba11f049941754d8b18c (diff) | |
download | bcfg2-471b5bf0d417a2847d40aee33652ca6d22dd964d.tar.gz bcfg2-471b5bf0d417a2847d40aee33652ca6d22dd964d.tar.bz2 bcfg2-471b5bf0d417a2847d40aee33652ca6d22dd964d.zip |
Fix bcfg2-info failure if no repo has been created (Resolves Ticket #556)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4622 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Core.py | 5 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Metadata.py | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 6bdf2c930..6a6264e9a 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -241,7 +241,10 @@ class Core(object): except: logger.error("Unexpected instantiation failure for plugin %s" % (plugin), exc_info=1) - self.metadata = self.plugins['Metadata'] + if 'Metadata' in self.plugins: + self.metadata = self.plugins['Metadata'] + else: + raise CoreInitError, "No Metadata plugin loaded" for plugin in structures: if self.plugins.has_key(plugin): self.structures.append(self.plugins[plugin]) diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py index 851c3bc51..15e4177e8 100644 --- a/src/lib/Server/Plugins/Metadata.py +++ b/src/lib/Server/Plugins/Metadata.py @@ -66,8 +66,11 @@ class Metadata(Bcfg2.Server.Plugin.Plugin): def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) self.__name__ = 'Metadata' - core.fam.AddMonitor("%s/%s" % (self.data, "groups.xml"), self) - core.fam.AddMonitor("%s/%s" % (self.data, "clients.xml"), self) + try: + core.fam.AddMonitor("%s/%s" % (self.data, "groups.xml"), self) + core.fam.AddMonitor("%s/%s" % (self.data, "clients.xml"), self) + except: + raise Bcfg2.Server.Plugin.PluginInitError self.states = {'groups.xml':False, 'clients.xml':False} self.addresses = {} self.clients = {} |