From 4e8bc5c002a54aaee1368330be6374c2e9deda59 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 5 Nov 2014 16:18:33 +0100 Subject: 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. --- src/lib/Bcfg2/Client/Tools/APT.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-1-g7c22