From ffe53b207532d165f3e6019e10ee27f23e0b3e84 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Wed, 18 Mar 2015 16:18:13 -0700 Subject: gkeys: Remove gpgsearch option from list-key action The default action for list-key is to now list all keys found in the keydir. Regardless if they are in the db's seed file for that keydir. --- gkeys/gkeys/action_map.py | 2 +- gkeys/gkeys/actions.py | 48 ++++++++++------------------------------------- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/gkeys/gkeys/action_map.py b/gkeys/gkeys/action_map.py index d547ab3..3b1b9d0 100644 --- a/gkeys/gkeys/action_map.py +++ b/gkeys/gkeys/action_map.py @@ -157,7 +157,7 @@ Found: ('list-key', { 'func': 'listkey', 'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys', - 'keydir', 'keyring', 'gpgsearch'], + 'keydir', 'keyring'], 'desc': '''Pretty-print the selected gpg key''', 'long_desc': '''Pretty-print the selected gpg key''', 'example': '''gkeys list-key -C gentoo -n gkeys diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py index efab4fa..edbea0d 100644 --- a/gkeys/gkeys/actions.py +++ b/gkeys/gkeys/actions.py @@ -206,45 +206,17 @@ class Actions(object): results = {} success = [] messages = [] - if args.gpgsearch: - keyresults = seeds.seeds - # pick any key - key = keyresults[sorted(keyresults)[0]] - result = self.gpg.list_keys(key.keydir, args.gpgsearch) - # now split the results and reverse lookup the gkey - lines = result.output.split('\n') - while lines: - # determine the end of the first key listing - index = lines.index('') - keyinfo = lines[:index] - # trim off the first keys info - lines = lines[index + 1:] - # make sure it is a key listing - if len(keyinfo) < 2: - break - # get the fingerprint from the line - fpr = keyinfo[1].split('= ')[1] - # search for the matching gkey - kwargs = {'keydir': args.keydir, 'fingerprint': [fpr]} - keyresults = seeds.list(**kwargs) - # list the results - for key in sorted(keyresults): - ls, lr = self._list_it(key, '\n'.join(keyinfo)) - success.append(ls) - results[key.name] = lr + kwargs = handler.build_gkeydict(args) + keyresults = seeds.list(**kwargs) + for key in sorted(keyresults): + if args.fingerprint: + result = self.gpg.list_keys(key.keydir, kwargs['fingerprint']) + else: + result = self.gpg.list_keys(key.keydir) + ls, lr = self._list_it(key, result.output) + success.append(ls) + results[key.name] = lr messages = ["Done."] - else: - kwargs = handler.build_gkeydict(args) - keyresults = seeds.list(**kwargs) - for key in sorted(keyresults): - if args.fingerprint: - result = self.gpg.list_keys(key.keydir, kwargs['fingerprint']) - else: - result = self.gpg.list_keys(key.keydir) - ls, lr = self._list_it(key, result.output) - success.append(ls) - results[key.name] = lr - messages = ["Done."] if not messages: messages = ['No results found meeting criteria', "Did you specify -n foo or -n '*'"] -- cgit v1.2.3-65-gdbad