diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-08-16 19:52:54 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-08-16 19:52:54 +0000 |
commit | cc4c455ade877ef2b2345a59e2e0f12e8cbc7abe (patch) | |
tree | 564b5aab6df0c50a808794bf788d85fa74118e20 | |
parent | d29d60c08a75a36125bd87decd42bce895d014c1 (diff) | |
download | bcfg2-cc4c455ade877ef2b2345a59e2e0f12e8cbc7abe.tar.gz bcfg2-cc4c455ade877ef2b2345a59e2e0f12e8cbc7abe.tar.bz2 bcfg2-cc4c455ade877ef2b2345a59e2e0f12e8cbc7abe.zip |
Packages: Handle file fetch errors (on repo refresh) better
(reported by m4z)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5407 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 38364fbc8..ee15ba61d 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -79,9 +79,14 @@ class Source(object): def update(self): for url in self.urls: - print "updating", url + logger.info("Packages: Updating %s" % url) fname = self.escape_url(url) - data = urllib2.urlopen(url).read() + try: + data = urllib2.urlopen(url).read() + except urllib2.HTTPError, h: + logger.error("Packages: Failed to fetch url %s. code=%s" \ + % (url, h.code)) + continue file(fname, 'w').write(data) def applies(self, metadata): |