public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/
Date: Mon, 22 Dec 2014 23:11:39 +0000 (UTC)	[thread overview]
Message-ID: <1419093965.62ee882e544cac60c9aeeeec784265bd2cfe1c35.dol-sen@gentoo> (raw)

commit:     62ee882e544cac60c9aeeeec784265bd2cfe1c35
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 11 00:52:09 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Dec 20 16:46:05 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=62ee882e

gkeys: Add refreshkey action and support code

---
 gkeys/actions.py | 30 ++++++++++++++++++++++++++++++
 gkeys/lib.py     | 18 ++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/gkeys/actions.py b/gkeys/actions.py
index 4c430e7..5b534cb 100644
--- a/gkeys/actions.py
+++ b/gkeys/actions.py
@@ -27,6 +27,7 @@ from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn
 Available_Actions = ['listseed', 'addseed', 'removeseed', 'moveseed', 'fetchseed',
             'listseedfiles', 'listkey', 'installkey', 'removekey', 'movekey',
             'installed', 'importkey', 'verify', 'checkkey', 'sign', 'speccheck']
+            'refreshkey']
 
 Action_Options = {
     'listseed': ['nick', 'name', 'keydir', 'fingerprint', 'seedfile', 'file'],
@@ -45,6 +46,7 @@ Action_Options = {
     'checkkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
     'sign': ['nick', 'name', 'keydir', 'fingerprint', 'file', 'keyring'],
     'speccheck': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
+    'refreshkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
 }
 
 
@@ -733,3 +735,31 @@ class Actions(object):
                 )
                 success.append(True)
         return (False not in success, ['', msgs])
+
+
+    def refreshkey(self, args):
+        '''Calls gpg with the --refresh-keys option
+        for in place updates of the installed keys'''
+        if not args.category:
+            return (False, ["Please specify seeds type."])
+        self.logger.debug("ACTIONS: refreshkey; args: %s" % str(args))
+        handler = SeedHandler(self.logger, self.config)
+        seeds = handler.load_category(args.category)
+        catdir = self.config.get_key(args.category + "-category")
+        self.logger.debug("ACTIONS: refreshkey; catdir = %s" % catdir)
+        self.gpg = GkeysGPG(self.config, catdir)
+        results = {}
+        kwargs = handler.build_gkeydict(args)
+        keyresults = seeds.list(**kwargs)
+        self.output('', '\n Refreshig keys...')
+        for gkey in sorted(keyresults):
+            self.logger.info("Refreshig key %s, %s" % (gkey.nick, gkey.keyid))
+            self.output('', "  %s: %s" % (gkey.name, ', '.join(gkey.keyid)))
+            #self.output('', "  ===============")
+            self.logger.debug("ACTIONS: refreshkey; gkey = %s" % str(gkey))
+            results[gkey.keydir] = self.gpg.refresh_key(gkey)
+        return (True, ['Completed'])
+
+
+
+

diff --git a/gkeys/lib.py b/gkeys/lib.py
index d2b3119..50ed63e 100644
--- a/gkeys/lib.py
+++ b/gkeys/lib.py
@@ -179,6 +179,24 @@ class GkeysGPG(GPG):
         return []
 
 
+    def refresh_key(self, gkey):
+        '''Refresh the specified key in the specified keydir
+
+        @param key: tuple of (name, nick, keydir, fingerprint)
+        @param keydir: the keydir to add the key to
+        '''
+        self.config.defaults['gpg_defaults'].append('--no-permission-warning')
+        self.set_keyserver()
+        self.set_keydir(gkey.keydir, 'refresh-keys', reset=True)
+        self.set_keyring('pubring.gpg', 'refresh-keys', reset=False)
+        logger.debug("LIB: refresh_key, gkey: %s" % str(gkey))
+        logger.debug("** Calling runGPG with Running 'gpg %s --refresh-keys' for: %s"
+            % (' '.join(self.config.get_key('tasks', 'refresh-keys')), str(gkey)))
+        result = self.runGPG(task='refresh-keys', inputfile='')
+        logger.info('GPG return code: ' + str(result.returncode))
+        return result
+
+
     def update_key(self, gkey, keydir):
         '''Update the specified key in the specified keydir
 


             reply	other threads:[~2014-12-22 23:11 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 23:11 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-06-01 15:16 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/ Brian Dolbec
2015-08-09  3:44 Robin H. Johnson
2014-12-24 20:05 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-08-20  3:55 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-06-01 15:25 Brian Dolbec
2014-05-28  2:21 Brian Dolbec
2014-05-28  2:21 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-17 18:13 Brian Dolbec
2014-03-01 17:50 Pavlos Ratis
2014-03-01 17:50 Pavlos Ratis
2014-03-01 17:49 Pavlos Ratis
2014-03-01  0:07 Brian Dolbec
2014-02-28 23:56 Brian Dolbec
2014-02-28 20:21 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-17  7:39 Brian Dolbec
2013-11-15  9:16 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-16  0:50 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2013-06-23  7:13 Brian Dolbec
2012-12-10  4:56 Brian Dolbec
2012-12-10  4:56 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 Brian Dolbec
2012-12-10  3:26 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419093965.62ee882e544cac60c9aeeeec784265bd2cfe1c35.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox