From 826f385767ccf9f608fcfbe35e381a9dbc59db4b Mon Sep 17 00:00:00 2001 From: Mike McCallister Date: Sat, 15 Oct 2011 22:06:31 -0500 Subject: 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. --- src/lib/Server/Plugins/Packages/PackagesSources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/Server/Plugins/Packages/PackagesSources.py') diff --git a/src/lib/Server/Plugins/Packages/PackagesSources.py b/src/lib/Server/Plugins/Packages/PackagesSources.py index 5f82deb1f..6d0b1d732 100644 --- a/src/lib/Server/Plugins/Packages/PackagesSources.py +++ b/src/lib/Server/Plugins/Packages/PackagesSources.py @@ -48,7 +48,7 @@ class PackagesSources(Bcfg2.Server.Plugin.SingleXMLFileBacked, sources.xml """ stype = xsource.get("type") if stype is None: - logger.error("No type specified for source, skipping") + logger.error("Packages: No type specified for source, skipping") return None try: @@ -57,7 +57,7 @@ class PackagesSources(Bcfg2.Server.Plugin.SingleXMLFileBacked, stype.title()) cls = getattr(module, "%sSource" % stype.title()) except (ImportError, AttributeError): - logger.error("Unknown source type %s" % stype) + logger.error("Packages: Unknown source type %s" % stype) return None return cls(self.cachepath, xsource, self.config) -- cgit v1.2.3-1-g7c22