From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/
Date: Tue, 16 Jul 2013 00:50:14 +0000 (UTC) [thread overview]
Message-ID: <1373822122.c7c2cd9758351b873324b5faaf06e2a34f39b22d.dol-sen@gentoo> (raw)
commit: c7c2cd9758351b873324b5faaf06e2a34f39b22d
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 06:04:26 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jul 14 17:15:22 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=c7c2cd97
Split out common keypath code to it's own function
Add a reset task() to clear/reset additional args.
Code list_keys()
---
gkeys/lib.py | 58 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 44 insertions(+), 14 deletions(-)
diff --git a/gkeys/lib.py b/gkeys/lib.py
index cae7f07..0f7ae5e 100644
--- a/gkeys/lib.py
+++ b/gkeys/lib.py
@@ -36,6 +36,28 @@ class GkeysGPG(GPG):
GPG.__init__(self, config)
self.config = config
self.keydir = keydir
+ self.task = None
+ self.task_value = None
+
+
+ def set_keypath(self, keyring, task=None):
+ logger.debug("keydir: %s, keyring: %s" % (self.keydir, keyring))
+ self.task = task
+ keypath = pjoin(self.keydir, keyring)
+ # --keyring file | Note that this adds a keyring to the current list.
+ # If the intent is to use the specified keyring alone,
+ # use --keyring along with --no-default-keyring.
+ self.task_value = ['--no-default-keyring', '--keyring', keypath]
+ task.extend(self.task_value)
+ return
+
+
+ def reset_task(self):
+ if self.task:
+ for item in self.task_value:
+ self.task.remove(item)
+ self.task = None
+ self.task_value = None
def add_key(self, gkey):
@@ -44,14 +66,8 @@ class GkeysGPG(GPG):
@param gkey: GKEY namedtuple with
(name, keyid/longkeyid, keyring, fingerprint,)
'''
- logger.debug("keydir: %s, keyring: %s" % (self.keydir, gkey.keyring))
- keypath = pjoin(self.keydir, gkey.keyring)
- # --keyring file | Note that this adds a keyring to the current list.
- # If the intent is to use the specified keyring alone,
- # use --keyring along with --no-default-keyring.
- self.config['tasks']['recv-keys'] = [
- '--no-default-keyring', '--keyring', keypath,
- ]
+ self.set_keypath(gkey.keyring, self.config['tasks']['recv-keys'])
+
# prefer the longkeyid if available
#logger.debug("LIB: add_key; keyids %s, %s"
# % (str(gkey.longkeyid), str(gkey.keyid)))
@@ -94,13 +110,13 @@ class GkeysGPG(GPG):
@param gkey: GKEY namedtuple with (name, keyid/longkeyid, fingerprint)
'''
- pass
+ return []
def del_keyring(self, keyring):
'''Delete the specified key to the specified keyring
'''
- pass
+ return []
def update_key(self, gkey, keyring):
@@ -109,22 +125,36 @@ class GkeysGPG(GPG):
@param key: tuple of (name, keyid, fingerprint)
@param keyring: the keyring to add the key to
'''
- pass
+ return []
- def list_keys(self, keyring=None):
+ def list_keys(self, keyring):
'''List all keys in the specified keyring or
all key in all keyrings if keyring=None
@param keyring: the keyring to add the key to
'''
- pass
+ if not keyring:
+ logger.debug("LIB: list_keys(), invalid keyring parameter: %s"
+ % str(keyring))
+ return []
+ if '--with-colons' in self.config['tasks']['list-keys']:
+ self.config['tasks']['list-keys'].remove('--with-colons')
+
+ self.set_keypath(keyring, self.config['tasks']['list-keys'])
+ logger.debug("** Calling runGPG with Running 'gpg %s --list-keys %s'"
+ % (' '.join(self.config['tasks']['list-keys']), keyring)
+ )
+ result = self.runGPG(task='list-keys', inputfile=keyring)
+ logger.info('GPG return code: ' + str(result.returncode))
+ self.reset_task()
+ return result
def list_keyrings(self):
'''List all available keyrings
'''
- pass
+ return []
def verify_key(self, gkey):
next reply other threads:[~2013-07-16 0:50 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 0:50 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-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-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=1373822122.c7c2cd9758351b873324b5faaf06e2a34f39b22d.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