diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-01-19 03:47:01 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-01-19 03:47:01 +0000 |
commit | d9b10e37fa1e9531b894634ae663f6c49621b677 (patch) | |
tree | 59ff3e13af84112ff65dd08b922744a9050b575a /src/lib/Server | |
parent | bdde74b47b38bb15c10b7533c212a37d9c928a8a (diff) | |
download | bcfg2-d9b10e37fa1e9531b894634ae663f6c49621b677.tar.gz bcfg2-d9b10e37fa1e9531b894634ae663f6c49621b677.tar.bz2 bcfg2-d9b10e37fa1e9531b894634ae663f6c49621b677.zip |
add Pkgmgr errors for null package indices
2005/01/18 20:56:31-06:00 anl.gov!desai
scope message
2005/01/18 20:56:13-06:00 anl.gov!desai
add error handling for package setup failure
(Logical change 1.192)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@813 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Generators/Pkgmgr.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/Server/Generators/Pkgmgr.py b/src/lib/Server/Generators/Pkgmgr.py index 1ad57e7a4..eb560b0a4 100644 --- a/src/lib/Server/Generators/Pkgmgr.py +++ b/src/lib/Server/Generators/Pkgmgr.py @@ -2,8 +2,9 @@ __revision__ = '$Revision$' from re import compile as regcompile +from syslog import syslog, LOG_ERR -from Bcfg2.Server.Generator import Generator, GeneratorError, DirectoryBacked, XMLFileBacked +from Bcfg2.Server.Generator import Generator, GeneratorError, GeneratorInitError, DirectoryBacked, XMLFileBacked class PackageEntry(XMLFileBacked): '''PackageEntry is a set of packages and locations for a single image''' @@ -41,7 +42,11 @@ class Pkgmgr(Generator): def __init__(self, core, datastore): Generator.__init__(self, core, datastore) - self.pkgdir = PackageDir(self.data, self.core.fam) + try: + self.pkgdir = PackageDir(self.data, self.core.fam) + except OSError: + syslog(LOG_ERR, "Pkgmgr: Failed to load package indices") + raise GeneratorInitError def FindHandler(self, entry): '''Non static mechanism of determining entry provisioning''' @@ -57,6 +62,9 @@ class Pkgmgr(Generator): if pkglist.packages.has_key(pkgname): entry.attrib.update(pkglist.packages[pkgname]) return + elif not self.pkgdir.has_key("%s.xml" % metadata.image): + syslog(LOG_ERR, "Pkgmgr: no package index for image %s" % metadata.image) + raise GeneratorError, ("Image", metadata.image) pkglist = self.pkgdir["%s.xml" % (metadata.image)] if pkglist.packages.has_key(pkgname): pkg = pkglist.packages[pkgname] |