diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2011-04-06 16:30:33 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2011-04-06 16:30:33 -0500 |
commit | f1cf457edb2a9552adf82d72541af69487f897f4 (patch) | |
tree | 28cc69390bf4e2ab24bb6c48ffdf2cc413df8526 /src/lib/Client/Tools/APT.py | |
parent | 3ae6271b798c7bb07d4ea864b081bc145774a704 (diff) | |
download | bcfg2-f1cf457edb2a9552adf82d72541af69487f897f4.tar.gz bcfg2-f1cf457edb2a9552adf82d72541af69487f897f4.tar.bz2 bcfg2-f1cf457edb2a9552adf82d72541af69487f897f4.zip |
APT: Catch apt-python initialization failures (#1001)
This still needs to be fixed in apt-python, but we can at least give the
user a smarter failure and disable the client tool properly here.
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Client/Tools/APT.py')
-rw-r--r-- | src/lib/Client/Tools/APT.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py index fe1ef6fdd..a838f5e27 100644 --- a/src/lib/Client/Tools/APT.py +++ b/src/lib/Client/Tools/APT.py @@ -69,7 +69,11 @@ class APT(Bcfg2.Client.Tools.Tool): if self.setup['kevlar'] and not self.setup['dryrun']: self.cmd.run("%s --force-confold --configure --pending" % DPKG) self.cmd.run("%s clean" % APTGET) - self.pkg_cache = apt.cache.Cache() + try: + self.pkg_cache = apt.cache.Cache() + except SystemError, e: + self.logger.info("Failed to initialize APT cache: %s" % e) + raise Bcfg2.Client.Tools.toolInstantiationError self.pkg_cache.update() self.pkg_cache = apt.cache.Cache() |