summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-08-05 15:16:09 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-08-05 15:16:09 -0400
commit835a434bc68fd497aad2d3a5db78d7ce83603e00 (patch)
tree314ee640415ed0ffa2b10c73af5319b285853219 /src/lib/Server/Plugins
parentca4029ea2186979604725428193a15fe22ca1b3c (diff)
downloadbcfg2-835a434bc68fd497aad2d3a5db78d7ce83603e00.tar.gz
bcfg2-835a434bc68fd497aad2d3a5db78d7ce83603e00.tar.bz2
bcfg2-835a434bc68fd497aad2d3a5db78d7ce83603e00.zip
fixed backtrace if Packages downloads a bogus GPG key
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r--src/lib/Server/Plugins/Packages.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py
index a4fb713d4..05c32d82f 100644
--- a/src/lib/Server/Plugins/Packages.py
+++ b/src/lib/Server/Plugins/Packages.py
@@ -1238,12 +1238,19 @@ class Packages(Bcfg2.Server.Plugin.Plugin,
if has_yum:
# add the key to the specification to ensure it
# gets installed
- kinfo = yum.misc.getgpgkeyinfo(kdata)
- version = yum.misc.keyIdToRPMVer(kinfo['keyid'])
- release = yum.misc.keyIdToRPMVer(kinfo['timestamp'])
-
- lxml.etree.SubElement(keypkg, 'Instance', version=version,
- release=release, simplefile=remotekey)
+ try:
+ kinfo = yum.misc.getgpgkeyinfo(kdata)
+ version = yum.misc.keyIdToRPMVer(kinfo['keyid'])
+ release = yum.misc.keyIdToRPMVer(kinfo['timestamp'])
+
+ lxml.etree.SubElement(keypkg, 'Instance',
+ version=version,
+ release=release,
+ simplefile=remotekey)
+ except ValueError:
+ err = sys.exc_info()[1]
+ self.logger.error("Could not read GPG key %s: %s" %
+ (localkey, err))
else:
self.logger.info("Yum libraries not found; GPG keys will "
"not be handled automatically")