summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Packages/Pac.py
diff options
context:
space:
mode:
authorMike McCallister <mike@mccllstr.com>2011-10-15 22:06:31 -0500
committerMike McCallister <mike@mccllstr.com>2011-10-15 23:41:21 -0500
commit826f385767ccf9f608fcfbe35e381a9dbc59db4b (patch)
tree2320daecca65d435d78e37f4fd213cd41119a07a /src/lib/Server/Plugins/Packages/Pac.py
parent17a031da6ec2ee448ee3d8e18dde5c6a3785c464 (diff)
downloadbcfg2-826f385767ccf9f608fcfbe35e381a9dbc59db4b.tar.gz
bcfg2-826f385767ccf9f608fcfbe35e381a9dbc59db4b.tar.bz2
bcfg2-826f385767ccf9f608fcfbe35e381a9dbc59db4b.zip
Improve error handling of Packages plugin.
Provide a descriptive error message that avoids logging a traceback. Error out (instead of continuing) upon receiving an HTTP error or an indication that the URL is malformed. Only write data to the cache file if it was successfully retrieved from the URL. Make log messages for Packages plugin use consistent "Packages:" prefix.
Diffstat (limited to 'src/lib/Server/Plugins/Packages/Pac.py')
-rw-r--r--src/lib/Server/Plugins/Packages/Pac.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/Server/Plugins/Packages/Pac.py b/src/lib/Server/Plugins/Packages/Pac.py
index 881df0ced..35fb39d02 100644
--- a/src/lib/Server/Plugins/Packages/Pac.py
+++ b/src/lib/Server/Plugins/Packages/Pac.py
@@ -9,7 +9,7 @@ logger = logging.getLogger("Packages")
class PacCollection(Collection):
def get_group(self, group):
- self.logger.warning("Package groups are not supported by APT")
+ self.logger.warning("Packages: Package groups are not supported by APT")
return []
class PacSource(Source):
@@ -71,17 +71,17 @@ class PacSource(Source):
bdeps[barch] = dict()
bprov[barch] = dict()
try:
- logger.debug("try to read : " + fname)
+ logger.debug("Packages: try to read : " + fname)
tar = tarfile.open(fname, "r")
reader = gzip.GzipFile(fname)
except:
- logger.error("Failed to read file %s" % fname)
+ logger.error("Packages: Failed to read file %s" % fname)
raise
for tarinfo in tar:
if tarinfo.isdir():
self.pkgnames.add(tarinfo.name.rsplit("-", 2)[0])
- logger.debug("added : " + tarinfo.name.rsplit("-", 2)[0])
+ logger.debug("Packages: added : " + tarinfo.name.rsplit("-", 2)[0])
tar.close()
self.deps['global'] = dict()