diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-11-05 16:18:33 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-11-05 16:21:00 +0100 |
commit | 4e8bc5c002a54aaee1368330be6374c2e9deda59 (patch) | |
tree | f56ff651c215d1c4c823a85aac1ea42921c06d73 | |
parent | 84ba7561d9450d05b0dd99b69c16437b29100704 (diff) | |
download | bcfg2-4e8bc5c002a54aaee1368330be6374c2e9deda59.tar.gz bcfg2-4e8bc5c002a54aaee1368330be6374c2e9deda59.tar.bz2 bcfg2-4e8bc5c002a54aaee1368330be6374c2e9deda59.zip |
Client/Tools/APT: handle exceptions gracefully
Exceptions during cache update (in kevlar mode) should not prevent
the client tool from initializing. In the worst case the old cache
would be used for the client run.
-rw-r--r-- | src/lib/Bcfg2/Client/Tools/APT.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py index 0a8fe387f..d736b12ea 100644 --- a/src/lib/Bcfg2/Client/Tools/APT.py +++ b/src/lib/Bcfg2/Client/Tools/APT.py @@ -68,7 +68,11 @@ class APT(Bcfg2.Client.Tools.Tool): e = sys.exc_info()[1] self.logger.info("Failed to initialize APT cache: %s" % e) raise Bcfg2.Client.Tools.ToolInstantiationError - self.pkg_cache.update() + try: + self.pkg_cache.update() + except FetchFailedException: + e = sys.exc_info()[1] + self.logger.info("Failed to update APT cache: %s" % e) self.pkg_cache = apt.cache.Cache() if 'req_reinstall_pkgs' in dir(self.pkg_cache): self._newapi = True |