[yum-commits] Branch 'yum-3_2_X' - yum/__init__.py
skvidal at osuosl.org
skvidal at osuosl.org
Sun Jan 23 15:51:44 UTC 2011
yum/__init__.py | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
New commits:
commit 864b994e538862606183e67e3c794764d18f119a
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Sat Jan 22 12:32:59 2011 -0500
when we import CA keys - write out the keyid of the ones the user has agreed to
then if we have the same ca key for multiple repos we don't constantly reprompt the user
diff --git a/yum/__init__.py b/yum/__init__.py
index 2d9385e..efe6f07 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4561,16 +4561,25 @@ class YumBase(depsolve.Depsolve):
keyurl, info['hexkeyid']))
key_installed = True
continue
-
# Try installing/updating GPG key
if is_cakey:
+ # know where the 'imported_cakeys' file is
+ ikf = repo.base_persistdir + '/imported_cakeys'
keytype = 'CA'
+ cakeys = []
+ try:
+ cakeys_d = open(ikf, 'r').read()
+ cakeys = cakeys_d.split('\n')
+ except (IOError, OSError):
+ pass
+ if str(info['hexkeyid']) in cakeys:
+ key_installed = True
else:
keytype = 'GPG'
-
- if repo.gpgcakey and info['has_sig'] and info['valid_sig']:
- key_installed = True
- else:
+ if repo.gpgcakey and info['has_sig'] and info['valid_sig']:
+ key_installed = True
+
+ if not key_installed:
self._getKeyImportMessage(info, keyurl, keytype)
rc = False
if self.conf.assumeyes:
@@ -4591,7 +4600,18 @@ class YumBase(depsolve.Depsolve):
raise Errors.YumBaseError, _('Key import failed')
self.logger.info(_('Key imported successfully'))
key_installed = True
-
+ # write out the key id to imported_cakeys in the repos basedir
+ if is_cakey and key_installed:
+ if info['hexkeyid'] not in cakeys:
+ ikfo = open(ikf, 'a')
+ try:
+ ikfo.write(info['hexkeyid']+'\n')
+ ikfo.flush()
+ ikfo.close()
+ except (IOError, OSError):
+ # maybe a warning - but in general this is not-critical, just annoying to the user
+ pass
+
if not key_installed:
raise Errors.YumBaseError, \
_('The GPG keys listed for the "%s" repository are ' \
More information about the Yum-commits
mailing list