diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-04-23 20:34:25 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-04-23 20:34:25 +0000 |
commit | 63ecef1656352ac0ab02290e89830e259914f279 (patch) | |
tree | 65f73a04a6abd6887bc77de2f5110d8bad96dc91 /src | |
parent | e43090ad53c0d25e74969cbc81e0c5229f64a25d (diff) | |
download | bcfg2-63ecef1656352ac0ab02290e89830e259914f279.tar.gz bcfg2-63ecef1656352ac0ab02290e89830e259914f279.tar.bz2 bcfg2-63ecef1656352ac0ab02290e89830e259914f279.zip |
Packages: improve error handing (Patch from Tim Laszlo)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5175 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 2b00d68b6..54f5be9e7 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -1,4 +1,4 @@ -import copy, gzip, lxml.etree, re, urllib +import copy, gzip, lxml.etree, re, urllib2 import os import Bcfg2.Server.Plugin @@ -45,7 +45,7 @@ class Source(object): for url in self.urls: print "updating", url fname = self.mk_fname(url) - data = urllib.urlopen(url).read() + data = urllib2.urlopen(url).read() file(fname, 'w').write(data) def applies(self, metadata): @@ -313,8 +313,11 @@ class Packages(Bcfg2.Server.Plugin.Plugin, source.read_files() except: self.logger.info("File read failed; updating sources", exc_info=1) - source.update() - source.read_files() + try: + source.update() + source.read_files() + except IOError, e: + self.logger.error("Failed to update sources: " + str(e.code)) self.sentinels.update(source.basegroups) def get_matching_sources(self, meta): |