Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 87f0b9badc54ef19de5357976df763b6 > files > 2

fedup-0.8.0-3.fc18.src.rpm

From 979e67b5d64a6153129480ce757e344be2009913 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Fri, 6 Dec 2013 15:35:33 -0500
Subject: [PATCH 2/3] Improve log messages when the GPG key is missing

Before, if the GPG key was missing, you'd get:

  fedup.yum:check_keyfile() REJECTED: %s does not belong to any package

So - fix the misplaced format string, and actually check to see if the
file *exists* before bothering to look it up in RPMDB.
---
 fedup/download.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fedup/download.py b/fedup/download.py
index ba6f1f1..3c86b6e 100644
--- a/fedup/download.py
+++ b/fedup/download.py
@@ -501,14 +501,21 @@ class UpgradeDownloader(yum.YumBase):
         '''
         if keyfile.startswith('file://'):
             keyfile = keyfile[7:]
+
+        log.info("checking keyfile %s", keyfile)
+
+        # does the key exist?
+        if not os.path.exists(keyfile):
+            log.info("ERROR: keyfile does not exist")
+            return False
+
         # did the key come from a package?
         keypkgs = self.rpmdb.searchFiles(keyfile)
-        log.info("checking keyfile %s", keyfile)
         if keypkgs:
             keypkg = sorted(keypkgs)[-1]
             log.debug("keyfile owned by package %s", keypkg.nevr)
         if not keypkgs:
-            log.info("REJECTED: %s does not belong to any package")
+            log.info("REJECTED: keyfile does not belong to any package")
             return False
 
         # was that package signed?
-- 
1.8.3.1