public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/, gkeys-ldap/gkeyldap/
@ 2014-12-26 18:37 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2014-12-26 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     2e27c4aa99721b05f0a9aca1b494f31f648218a8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 26 09:34:05 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Dec 26 09:34:05 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=2e27c4aa

gkeys/base.py: Shorten and enhance epilog message

The message was hitting a forced line wrapping right at "system"
Enhance (capitolize) a few important words.

---
 gkeys-ldap/gkeyldap/cli.py | 3 +--
 gkeys/gkeys/base.py        | 3 +--
 gkeys/gkeys/cli.py         | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gkeys-ldap/gkeyldap/cli.py b/gkeys-ldap/gkeyldap/cli.py
index fd29a94..bb4f5c3 100644
--- a/gkeys-ldap/gkeyldap/cli.py
+++ b/gkeys-ldap/gkeyldap/cli.py
@@ -37,8 +37,7 @@ class Main(CliBase):
             'Action_Options': Action_Options,
             'prog': 'gkey-ldap',
             'description': 'Gentoo-keys LDAP interface and seed file generator program',
-            'epilog': '''Caution: adding untrusted keys to these keyrings can
-                be hazardous to your system!'''
+            'epilog': '''CAUTION: adding UNTRUSTED keys can be HAZARDOUS to your system!'''
         }
 
 

diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py
index b09082f..f9a019f 100644
--- a/gkeys/gkeys/base.py
+++ b/gkeys/gkeys/base.py
@@ -36,8 +36,7 @@ class CliBase(object):
             'Action_Options': [],
             'prog': 'gkeys',
             'description': 'Gentoo-keys manager program',
-            'epilog': '''Caution: adding untrusted keys to these keyrings can
-                be hazardous to your system!'''
+            'epilog': '''Caution: adding UNTRUSTED keys can be HAZARDOUS to your system!'''
         }
         self.config = None
         self.args = None

diff --git a/gkeys/gkeys/cli.py b/gkeys/gkeys/cli.py
index 32d2ec4..c8ce6bc 100644
--- a/gkeys/gkeys/cli.py
+++ b/gkeys/gkeys/cli.py
@@ -40,8 +40,7 @@ class Main(CliBase):
             'Action_Options': Action_Options,
             'prog': 'gkeys',
             'description': 'Gentoo-keys manager program',
-            'epilog': '''Caution: adding untrusted keys to these keyrings can
-                be hazardous to your system!'''
+            'epilog': '''CAUTION: adding UNTRUSTED keys can be HAZARDOUS to your system!'''
         }
 
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/, gkeys-ldap/gkeyldap/
@ 2014-12-26 18:37 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2014-12-26 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     3fb60f5c114d9784bdc3609cdf20bd7062cf3044
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 26 18:36:04 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri Dec 26 18:36:04 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=3fb60f5c

Map sub commands to class functions

This allows the use of hypens in subcommands because 
they are no longer directly mapped to the class function they initiate.
Do some more fine tuning of the grouping identifiers.

---
 gkeys-ldap/gkeyldap/actions.py |  5 +++
 gkeys-ldap/gkeyldap/cli.py     |  4 ++-
 gkeys/gkeys/actions.py         | 74 ++++++++++++++++++++++++++++--------------
 gkeys/gkeys/base.py            | 13 +++++---
 gkeys/gkeys/cli.py             |  3 +-
 5 files changed, 67 insertions(+), 32 deletions(-)

diff --git a/gkeys-ldap/gkeyldap/actions.py b/gkeys-ldap/gkeyldap/actions.py
index 1d8e848..b543685 100644
--- a/gkeys-ldap/gkeyldap/actions.py
+++ b/gkeys-ldap/gkeyldap/actions.py
@@ -25,6 +25,11 @@ Action_Options = {
     'updateseeds': ['fingerprint', 'mail', 'name', 'nick', 'category', 'status'],
 }
 
+Action_Map = {
+    'ldap-search': 'ldapsearch',
+    'update-seeds': 'updateseeds',
+}
+
 
 def get_key_ids(key_len, keyids):
     '''Small utility function to return only keyid (short)

diff --git a/gkeys-ldap/gkeyldap/cli.py b/gkeys-ldap/gkeyldap/cli.py
index bb4f5c3..c85176f 100644
--- a/gkeys-ldap/gkeyldap/cli.py
+++ b/gkeys-ldap/gkeyldap/cli.py
@@ -12,7 +12,8 @@ from gkeys import seed
 from gkeys.base import CliBase
 from gkeys.config import GKeysConfig
 from gkeyldap import connect, search
-from gkeyldap.actions import Actions, Available_Actions, Action_Options
+from gkeyldap.actions import (Actions, Available_Actions, Action_Options,
+    Action_Map)
 
 
 class Main(CliBase):
@@ -35,6 +36,7 @@ class Main(CliBase):
             'Actions': Actions,
             'Available_Actions': Available_Actions,
             'Action_Options': Action_Options,
+            'Action_Map': Action_Map,
             'prog': 'gkey-ldap',
             'description': 'Gentoo-keys LDAP interface and seed file generator program',
             'epilog': '''CAUTION: adding UNTRUSTED keys can be HAZARDOUS to your system!'''

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index ea42b6d..ded3df7 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -31,40 +31,64 @@ from gkeys.config import GKEY
 from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn
 
 
-Seed_Actions = ['SEED_COMMANDS', 'addseed', 'fetchseed', 'listcats', 'listseed', 'listseedfiles',
-    'moveseed', 'removeseed']
+Seed_Actions = ['----seeds----', 'add-seed', 'fetch-seed', 'list-cats',
+    'list-seed', 'list-seedfiles', 'move-seed', 'remove-seed']
 
-Key_Actions = ['KEY_COMMANDS', 'checkkey', 'importkey', 'installed', 'installkey', 'listkey',
-    'movekey', 'refreshkey', 'removekey']
+Key_Actions = ['----keys-----', 'check-key', 'import-key', 'installed',
+    'install-key', 'list-key', 'move-key', 'refresh-key', 'remove-key',
+    'spec-check']
 
-General_Actions = ['GENERAL_COMMANDS', 'sign','verify']
+General_Actions = ['---general---', 'sign','verify']
 
-Available_Actions = Seed_Actions + Key_Actions + General_Actions
+Available_Actions = General_Actions + Key_Actions + Seed_Actions
 
 Action_Options = {
-    'listcats': [],
-    'listseed': ['nick', 'name', 'keydir', 'fingerprint', 'category', '1file'],
-    'addseed': ['nick', 'name', 'keydir', 'fingerprint', 'category'],
-    'removeseed': ['nick', 'name', 'keydir', 'fingerprint', 'category'],
-    'moveseed': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'dest'],
-    'fetchseed': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
-    'listseedfiles': [],
-    'listkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'gpgsearch', 'keyid'],
-    'installkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', '1file'],
-    'removekey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
-    'movekey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'dest'],
+    'list-cats': [],
+    'list-seed': ['nick', 'name', 'keydir', 'fingerprint', 'category', '1file'],
+    'add-seed': ['nick', 'name', 'keydir', 'fingerprint', 'category'],
+    'remove-seed': ['nick', 'name', 'keydir', 'fingerprint', 'category'],
+    'move-seed': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'dest'],
+    'fetch-seed': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
+    'list-seedfiles': [],
+    'list-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'gpgsearch', 'keyid'],
+    'install-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', '1file'],
+    'remove-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
+    'move-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'dest'],
     'installed': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
-    'importkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
+    'import-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring'],
     'verify': ['dest', 'nick', 'name', 'keydir', 'fingerprint', 'category', '1file', 'signature', 'timestamp'],
-    'checkkey': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
+    'check-key': ['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'],
-    'GENERAL_COMMANDS': [],
-    'SEED_COMMANDS': [],
-    'KEY_COMMANDS': [],
+    'spec-check': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
+    'refresh-key': ['nick', 'name', 'keydir', 'fingerprint', 'category', 'keyring', 'keyid'],
+    '---general---': [],
+    '----seeds----': [],
+    '----keys-----': [],
 }
 
+Action_Map = {
+    'list-cats': 'listcats',
+    'list-seed': 'listseed',
+    'add-seed': 'addseed',
+    'remove-seed': 'removeseed',
+    'move-seed': 'moveseed',
+    'fetch-seed': 'fetchseed',
+    'list-seedfiles': 'listseedfiles',
+    'list-key': 'listkey',
+    'install-key': 'installkey',
+    'remove-key': 'removekey',
+    'move-key': 'movekey',
+    'installed': 'installed',
+    'import-key': 'importkey',
+    'verify': 'verify',
+    'check-key': 'checkkey',
+    'sign': 'sign',
+    'spec-check': 'speccheck',
+    'refresh-key': 'refreshkey',
+    '---general---': 'GENERAL_COMMANDS',
+    '----seeds----': 'SEED_COMMANDS',
+    '----keys-----': 'KEY_COMMANDS',
+}
 
 class Actions(object):
     '''Primary API actions'''
@@ -103,7 +127,7 @@ class Actions(object):
             try:
                 self.seeds = handler.load_seeds(args.category, args.nick)
             except ValueError:
-                return (False, ["Failed to load seed file. Consider fetching seedfiles."])
+                return (False, ['', "Failed to load seed file. Consider fetching seedfiles."])
         if self.seeds:
             results = self.seeds.list(**kwargs)
         else:

diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py
index 201f31c..56262df 100644
--- a/gkeys/gkeys/base.py
+++ b/gkeys/gkeys/base.py
@@ -31,9 +31,10 @@ class CliBase(object):
 
     def __init__(self):
         self.cli_config = {
-            'Actions': [],
+            'Actions': None,
             'Available_Actions': [],
-            'Action_Options': [],
+            'Action_Options': {},
+            'Action_Map': {},
             'prog': 'gkeys',
             'description': 'Gentoo-keys manager program',
             'epilog': '''Caution: adding UNTRUSTED keys can be HAZARDOUS to your system!'''
@@ -175,7 +176,8 @@ class CliBase(object):
             description='Valid subcommands',
             help='Additional help')
         for name in self.cli_config['Available_Actions']:
-            action_method = getattr(self.cli_config['Actions'], name)
+            action_method = getattr(self.cli_config['Actions'],
+                self.cli_config['Action_Map'][name])
             actiondoc = action_method.__doc__
             try:
                 text = actiondoc.splitlines()[0]
@@ -194,7 +196,7 @@ class CliBase(object):
         if not action:
             parser.print_usage()
             sys.exit(1)
-        elif action in ['GENERAL_COMMANDS', 'KEY_COMMANDS', 'SEED_COMMANDS']:
+        elif action in ['---general---', '----keys-----', '----seeds----']:
             parser.print_help()
             sys.exit(1)
         return parsed_args
@@ -250,7 +252,8 @@ class CliBase(object):
         self.actions = self.cli_config['Actions'](self.config, self.output_results, logger)
 
         # run the action
-        func = getattr(self.actions, '%s' % args.action)
+        func = getattr(self.actions, '%s'
+            % self.cli_config['Action_Map'][args.action])
         logger.debug('Main: run; Found action: %s' % args.action)
         success, results = func(args)
         if not results:

diff --git a/gkeys/gkeys/cli.py b/gkeys/gkeys/cli.py
index c8ce6bc..df81882 100644
--- a/gkeys/gkeys/cli.py
+++ b/gkeys/gkeys/cli.py
@@ -16,7 +16,7 @@ from __future__ import print_function
 import sys
 
 from gkeys.base import CliBase
-from gkeys.actions import Actions, Available_Actions, Action_Options
+from gkeys.actions import Actions, Available_Actions, Action_Options, Action_Map
 from gkeys.config import GKeysConfig
 
 
@@ -38,6 +38,7 @@ class Main(CliBase):
             'Actions': Actions,
             'Available_Actions': Available_Actions,
             'Action_Options': Action_Options,
+            'Action_Map': Action_Map,
             'prog': 'gkeys',
             'description': 'Gentoo-keys manager program',
             'epilog': '''CAUTION: adding UNTRUSTED keys can be HAZARDOUS to your system!'''


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/, gkeys-ldap/gkeyldap/
@ 2015-01-05 23:12 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2015-01-05 23:12 UTC (permalink / raw
  To: gentoo-commits

commit:     147295dbd64a178a918a41341aa12fc14ecd63f8
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  3 18:08:48 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan  5 22:14:36 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=147295db

gkeys: Move Action_Map and other non-operation data to action_map.py

This removes the bloat of the man page data and makes obtaining the data less taxing for non-operational needs.
Update Action_options import change
Add list-key example
Update more actions

---
 gkeys-ldap/gkeyldap/cli.py |   4 +-
 gkeys/gkeys/__init__.py    |   3 +-
 gkeys/gkeys/action_map.py  | 434 +++++++++++++++++++++++++++++++++++++++++++++
 gkeys/gkeys/actions.py     | 183 +------------------
 gkeys/gkeys/cli.py         |   3 +-
 5 files changed, 440 insertions(+), 187 deletions(-)

diff --git a/gkeys-ldap/gkeyldap/cli.py b/gkeys-ldap/gkeyldap/cli.py
index d0f57cf..0bca7c7 100644
--- a/gkeys-ldap/gkeyldap/cli.py
+++ b/gkeys-ldap/gkeyldap/cli.py
@@ -9,8 +9,7 @@ import sys
 
 from gkeys.base import CliBase
 from gkeys.config import GKeysConfig
-from gkeyldap.actions import (Actions, Available_Actions, Action_Options,
-    Action_Map)
+from gkeyldap.actions import (Actions, Available_Actions, Action_Map)
 
 
 class Main(CliBase):
@@ -32,7 +31,6 @@ class Main(CliBase):
         self.cli_config = {
             'Actions': Actions,
             'Available_Actions': Available_Actions,
-            'Action_Options': Action_Options,
             'Action_Map': Action_Map,
             'prog': 'gkey-ldap',
             'description': 'Gentoo-keys LDAP interface and seed file generator program',

diff --git a/gkeys/gkeys/__init__.py b/gkeys/gkeys/__init__.py
index d5a659e..7256297 100644
--- a/gkeys/gkeys/__init__.py
+++ b/gkeys/gkeys/__init__.py
@@ -5,7 +5,7 @@
 
 from collections import OrderedDict
 
-from gkeys.actions import Action_Map, Available_Actions
+from gkeys.action_map import Action_Map, Available_Actions
 
 
 __version__ = 'Git'
@@ -24,4 +24,5 @@ the GPG keys used for validation on users and Gentoo's infrastracutre servers.
 Gentoo Keys is able to verify GPG keys used for Gentoo's release media,
 such as installation CD's, Live DVD's, packages and other GPG signed documents.''',
     'sub-cmds': subdata,
+    'authors': ['Brian Dolbec <dolsen@gentoo.org>', 'Pavlos Ratis <dastergon@gentoo.org>'],
 }

diff --git a/gkeys/gkeys/action_map.py b/gkeys/gkeys/action_map.py
new file mode 100644
index 0000000..fc5bfb0
--- /dev/null
+++ b/gkeys/gkeys/action_map.py
@@ -0,0 +1,434 @@
+#
+#-*- coding:utf-8 -*-
+
+"""
+    Gentoo-keys - action_map.py
+
+    Primary api interface module data
+
+    @copyright: 2015 by Brian Dolbec <dol-sen@gentoo.org>
+    @license: GNU GPL2, see COPYING for details.
+"""
+
+
+from collections import OrderedDict
+
+
+Seed_Actions = ['----seeds----', 'add-seed', 'fetch-seed',
+    'list-seed', 'list-seedfiles', 'remove-seed']
+
+Key_Actions = ['----keys-----', 'check-key', 'installed',
+    'install-key', 'list-key', 'refresh-key', 'remove-key',
+    'search-key', 'spec-check']
+
+General_Actions = ['---general---', 'list-cats', 'sign','verify']
+
+Available_Actions = General_Actions + Key_Actions + Seed_Actions
+
+Action_Map = OrderedDict({
+    '---general---': {
+        'func': 'GENERAL_COMMANDS',
+        'options': [],
+        'desc': '''-----< general actions >------''',
+        'long_desc': '''''',
+        'example': '''''',
+        },
+    'list-cats': {
+        'func': 'listcats',
+        'options': [],
+        'desc': '''List seed file definitions (category names) found in the config''',
+        'long_desc': '''List seed file definitions (category names) found in the config.
+    These category names are used throughout the seed and key action operations.''',
+        'example': '''$ gkeys list-cats
+
+ Gkey task results:
+    Categories defined: gentoo-devs,  gentoo,  sign
+
+''',
+        },
+    'sign': {
+        'func': 'sign',
+        'options': ['nick', 'name', 'fingerprint', 'file', ],
+        'desc': '''Sign a file''',
+        'long_desc': '''Sign a file or files with the designated gpg key.
+    The default sign settings can be set in gpg.conf.  These settings can be
+    overridden on the command line using the 'nick', 'name', 'fingerprint' options''',
+        'example': '''''',
+        },
+    'verify': {
+        'func': 'verify',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keydir', 'keys',
+            '1file', 'signature', 'timestamp', 'dest'],
+        'desc': '''File automatic download and/or verification action.''',
+        'long_desc': '''File automatic download and/or verification action.
+    Note: If the specified key/keyring to verify against does not contain
+    the key used to sign the file.  It will Auto-search for the correct key
+    in the installed keys db. And verify against the matching key.
+    It will report the success/failure along with the key information used for
+    the verification''',
+        'example': '''$ gkeys verify -F /home/brian/gpg-test/seeds/gentoo-devs.seeds
+
+ Gkey task results:
+    Using config defaults..: gentoo gkeys
+    Verification succeeded.: /home/brian/gpg-test/seeds/gentoo-devs.seeds
+    Key info...............: Gentoo-Linux Gentoo-keys Project Signing Key <gkeys>, 0xA41DBBD9151C3FC7
+        category, nick.....: gentoo gkeys
+
+''',
+        },
+    '----keys-----': {
+        'func': 'KEY_COMMANDS',
+        'options': [],
+        'desc': '''-------< key actions >--------''',
+        'long_desc': '',
+        'example': '',
+        },
+    'check-key': {
+        'func': 'checkkey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Check key validity''',
+        'long_desc': '''Check keys actions
+    Performs basic validity checks on the key(s), checks expiry,
+    and presence of a signing sub-key''',
+        'example': '''$ gkeys check-key -C gentoo -n gkey
+
+ Checking keys...
+
+
+  gkeys, Gentoo-Linux Gentoo-keys Project Signing Key: 0xA41DBBD9151C3FC7, 0x825533CBF6CD6C97
+  ==============================================
+
+
+ Gkey task results:
+
+Found:
+-------
+    Expired: 0
+    Revoked: 0
+    Invalid: 0
+    No signing capable subkeys: 0
+''',
+        },
+    'import-key': {
+        'func': 'importkey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Add a specified key to a specified keyring''',
+        'long_desc': '''Add a specified key to a specified keyring''',
+        'example': '''''',
+        },
+    'install-key': {
+        'func': 'installkey',
+        'options':  ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', 'keyring', '1file'],
+        'desc': '''Install a key from the seed(s)''',
+        'long_desc': '''Install a key from the seed(s).  The key will be
+    installed to the pre-configured seed's keydir value within the category's directory.''',
+        'example': '''''',
+        },
+    'installed': {
+        'func': 'installed',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Lists the installed key directories''',
+        'long_desc': '''Lists the installed key directories''',
+        'example': '''$ gkeys installed -C gentoo
+
+ Gkey task results:
+    Found Key(s):
+    ----------
+    Name.........: Gentoo Tree Snapshot (Automated) Signing Key
+    Nick.........: snapshot
+    Keydir.......: release
+    UID..........: Gentoo Portage Snapshot Signing Key (Automated Signing Key)
+    Keyid........: 0xEC590EEAC9189250
+      Fingerprint: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
+    Keyid........: 0xDB6B8C1F96D8BF6D
+      Fingerprint: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
+
+    ----------
+    Name.........: Gentoo-Linux Gentoo-keys Project Signing Key
+    Nick.........: gkeys
+    Keydir.......: release
+<snip> ...
+''',
+        },
+    'list-key': {
+        'func': 'listkey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys',
+            'keydir', 'keyring', 'gpgsearch'],
+        'desc': '''Pretty-print the selected gpg key''',
+        'long_desc': '''Pretty-print the selected gpg key''',
+        'example': '''gkeys list-key -C gentoo -n gkeys
+
+Nick.....: gkeys
+Name.....: Gentoo-Linux Gentoo-keys Project Signing Key
+Keydir...: release
+Gpg info.: pub   4096R/825533CBF6CD6C97 2014-10-03 [expires: 2017-09-17]
+                 Key fingerprint = D2DE 1DBB A0F4 3EBA 341B  97D8 8255 33CB F6CD 6C97
+           uid               [ unknown] Gentoo-keys Team <gkeys@gentoo.org>
+           sub   4096R/A41DBBD9151C3FC7 2014-10-03 [expires: 2017-09-17]
+                 Key fingerprint = C287 1675 69B3 C1F9 E9CE  D677 A41D BBD9 151C 3FC7
+
+ Gkey task results:
+    Done.''',
+        },
+    'move-key': {
+        'func': 'movekey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', 'keyring', 'dest'],
+        'desc': '''Rename an installed keydir''',
+        'long_desc': '''Rename an installed keydir''',
+        'example': '''''',
+        },
+    'refresh-key': {
+        'func': 'refreshkey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Calls gpg with the --refresh-keys option
+        for in place updates of the installed keys''',
+        'long_desc': '''Calls gpg with the --refresh-keys option
+    for in place updates of the installed keys.  To refresh all installed keys
+    in the category, specify the category only.''',
+        'example': '''$ gkeys refresh-key -C gentoo -n gkey
+
+ Refreshig keys...
+
+  Gentoo-Linux Gentoo-keys Project Signing Key: 0xA41DBBD9151C3FC7, 0x825533CBF6CD6C97
+
+
+ Gkey task results:
+    Completed
+''',
+        },
+    'remove-key': {
+        'func': 'removekey',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Remove (uninstall) an installed key''',
+        'long_desc': '''Remove (uninstall) an installed key or keys''',
+        'example': '''$ gkeys remove-key -C gentoo-devs -n dolsen
+
+ Found GKEY seed:
+
+    ----------
+    Name.........: Brian Dolbec
+    Nick.........: dolsen
+    Keydir.......: dolsen
+    UID..........: Brian Dolbec (Gentoo Developer) <dolsen@gentoo.org>
+    UID..........: Brian Dolbec (Yes it's really me. Although which one of me is another question.) <brian.dolbec@gmail.com>
+    UID..........: Brian Dolbec <brian.dolbec@gmail.com>
+    UID..........: Brian Dolbec <dolsen@gentoo.org>
+    Keyid........: 0x65E309F2189DB0B8
+      Fingerprint: 76B63D6CCEC2FD160B0F5AC165E309F2189DB0B8
+    Keyid........: 0xFBBD087275820ED8
+      Fingerprint: A5D7C74E081CC70DB4A4AAF5FBBD087275820ED8
+    Keyid........: 0xD80F5F1E1245142E
+      Fingerprint: 262A829DFEAF9092A42C1C3ED80F5F1E1245142E
+    Keyid........: 0x018682231B926E4F
+      Fingerprint: 69FDA24269C8B5A7E9E231E9018682231B926E4F
+    Keyid........: 0xD245831F292B1FFB
+      Fingerprint: 93799ADE2C956B6553A23D8FD245831F292B1FFB
+    Keyid........: 0x2214D90A014F17CB
+      Fingerprint: 8688FD1CC71C1C04EAEA42372214D90A014F17CB
+
+
+Do you really want to remove dolsen?[y/n]: y
+
+ Gkey task results:
+    Done removing dolsen key.
+''',
+        },
+    'search-key': {
+        'func': 'key_search',
+        'options': ['category', 'nick', '1name', 'fingerprint', 'keyid', 'uid',
+            'keys', 'keydir', 'exact', 'all'],
+        'desc': '''Search for a key's seed in the installed keys db''',
+        'long_desc': '''Search for a key's seed in the installed keys db''',
+        'example': '''$ gkeys search-key  -n gkeys
+
+ Gkey task results:
+    Category.....: gentoo
+    ----------
+    Name.........: Gentoo-Linux Gentoo-keys Project Signing Key
+    Nick.........: gkeys
+    Keydir.......: release
+    UID..........: Gentoo-keys Team <gkeys@gentoo.org>
+    Keyid........: 0xA41DBBD9151C3FC7
+      Fingerprint: C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+    Keyid........: 0x825533CBF6CD6C97
+      Fingerprint: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97
+
+    Category.....: sign
+    ----------
+    Name.........: Gentoo-keys Team
+    Nick.........: gkeys
+    Keydir.......: gkeys
+    UID..........: Gentoo-keys Team <gkeys@gentoo.org>
+    Keyid........: 0x825533CBF6CD6C97
+      Fingerprint: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97
+    Keyid........: 0xA41DBBD9151C3FC7
+      Fingerprint: C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+''',
+        },
+    'spec-check': {
+        'func': 'speccheck',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys',
+            'keydir', 'keyring'],
+        'desc': '''Check if keys meet specifications requirements''',
+        'long_desc': '''Check if keys meet specifications requirements''',
+        'example': '''$ gkeys spec-check -C gentoo -n gkeys
+
+ Checking keys...
+
+  gkeys, Gentoo-Linux Gentoo-keys Project Signing Key: 0x825533CBF6CD6C97
+  ==============================================
+
+    ----------
+    Fingerprint......: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97
+    Key type ........: PUB    Capabilities.: cSC
+    Algorithm........: Pass   Bit Length...: Pass
+    Create Date......: Pass   Expire Date..: Pass
+    Key Version......: Pass   Validity.....: -, Unknown
+    Days till expiry.: 987
+    Capability.......: Pass
+    Qualified ID.....: Pass
+    This primary key.: Pass
+
+    ----------
+    Fingerprint......: C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+    Key type ........: SUB    Capabilities.: s  sign
+    Algorithm........: Pass   Bit Length...: Pass
+    Create Date......: Pass   Expire Date..: Pass
+    Key Version......: Pass   Validity.....: -, Unknown
+    Days till expiry.: 987
+    Capability.......: Pass
+    Qualified ID.....: Pass
+    This subkey......: Pass
+
+    Key summary
+    primary..........: Pass         signing subkey: Pass
+    encryption subkey: No    authentication subkey: No
+    SPEC requirements: Pass
+
+
+ No Encryption capable subkey (Notice only):
+     Gentoo-Linux Gentoo-keys Project Signing Key <gkeys>: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97
+
+ SPEC Approved:
+     Gentoo-Linux Gentoo-keys Project Signing Key <gkeys>: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97
+
+ Gkey task results:
+
+Found Failures:
+-------
+    Revoked................: 0
+    Invalid................: 0
+    No Signing subkey......: 0
+    No Encryption subkey...: 1
+    Algorithm..............: 0
+    Bit length.............: 0
+    Expiry.................: 0
+    Expiry Warnings........: 0
+    SPEC requirements......: 0
+    =============================
+    SPEC Approved..........: 1
+''',
+        },
+    '----seeds----': {
+        'func': 'SEED_COMMANDS',
+        'options': [],
+        'desc': '''------< seed actions >-------''',
+        'long_desc': '',
+        'example': '',
+        },
+    'add-seed': {
+        'func': 'addseed',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir',
+            'uid'],
+        'desc': '''Add or replace a key in the selected seed file''',
+        'long_desc': '''Add or replace a key in the selected seed file''',
+        'example': '''$ gkeys add-seed -C mykeys -n foo -N "Foo Bar" -r foobar -K C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+
+ Gkey task results:
+    Successfully added new seed.
+''',
+        },
+    'fetch-seed': {
+        'func': 'fetchseed',
+        'options': ['category', 'nick', '1file', 'dest', 'signature',
+            'timestamp'],
+        'desc': '''Download the selected seed file(s)''',
+        'long_desc': '''Download the selected seed file(s)''',
+        'example': '''$ gkeys fetch-seed -C gentoo-devs
+
+ Gkey task results:
+     Verification succeeded.: /home/brian/gpg-test/seeds/gentoo-devs.seeds
+     Key info...............: Gentoo-Linux Gentoo-keys Project Signing Key <gkeys>, 0xA41DBBD9151C3FC7
+         category, nick.....: gentoo gkeys
+
+    Fetch operation completed
+''',
+        },
+    'list-seed': {
+        'func': 'listseed',
+        'options': ['category', 'nick', 'name', 'fingerprint', 'keys',
+            'keydir', '1file'],
+        'desc': '''Pretty-print the selected seed file''',
+        'long_desc': '''Pretty-print the selected seed file''',
+        'example': '''$ gkeys list-seed -C gentoo -n gkeys
+
+ Gkey task results:
+
+    ----------
+    Name.........: Gentoo-Linux Gentoo-keys Project Signing Key
+    Nick.........: gkeys
+    Keydir.......: release
+    UID..........: Gentoo-keys Team <gkeys@gentoo.org>
+    Keyid........: 0xA41DBBD9151C3FC7
+      Fingerprint: C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+    Keyid........: 0x825533CBF6CD6C97
+      Fingerprint: D2DE1DBBA0F43EBA341B97D8825533CBF6CD6C97''',
+        },
+    'list-seedfiles': {
+        'func': 'listseedfiles',
+        'options': [],
+        'desc': '''List seed files found in the configured seed directory''',
+        'long_desc': '''List seed files found in the configured seed directory''',
+        'example': '''$ gkeys list-seedfiles
+
+ Gkey task results:
+    Seed files found at path: /home/brian/gpg-test/seeds
+  gentoo-devs.seeds
+  gentoo.seeds
+''',
+        },
+    'move-seed': {
+        'func': 'moveseed',
+        'options': ['category', 'nick', 'name', 'keydir', 'keys',
+            'fingerprint', 'dest'],
+        'desc': '''Move keys between seed files''',
+        'long_desc': '''Move keys between seed files''',
+        'example': '''''',
+        },
+    'remove-seed': {
+        'func': 'removeseed',
+        'options': ['category', 'nick', 'name', 'keys', 'fingerprint', 'keydir'],
+        'desc': '''Remove a seed from the selected seed file''',
+        'long_desc': '''Remove a seed from the selected seed file''',
+        'example': '''$ gkeys remove-seed -C mykeys -n foo
+
+ Gkey task results:
+    Successfully removed seed: True
+    ----------
+    Name.........: Foo Bar
+    Nick.........: foo
+    Keydir.......: foobar
+    Keyid........: 0xA41DBBD9151C3FC7
+      Fingerprint: C287167569B3C1F9E9CED677A41DBBD9151C3FC7
+''',
+        },
+})
+
+

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index b63f3f1..cfcc038 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -21,7 +21,7 @@ else:
     py_input = raw_input
 
 
-from collections import defaultdict, OrderedDict
+from collections import defaultdict
 from json import load
 from shutil import rmtree
 
@@ -31,187 +31,6 @@ from gkeys.gkey import GKEY
 from gkeys.checks import SPECCHECK_SUMMARY, convert_pf, convert_yn
 
 
-Seed_Actions = ['----seeds----', 'add-seed', 'fetch-seed',
-    'list-seed', 'list-seedfiles', 'move-seed', 'remove-seed']
-
-Key_Actions = ['----keys-----', 'check-key', 'installed',
-    'install-key', 'list-key', 'move-key', 'refresh-key', 'remove-key',
-    'search-key', 'spec-check']
-
-General_Actions = ['---general---', 'list-cats', 'sign','verify']
-
-Available_Actions = General_Actions + Key_Actions + Seed_Actions
-
-Action_Map = OrderedDict({
-    '---general---': {
-        'func': 'GENERAL_COMMANDS',
-        'options': [],
-        'desc': '''-----< general actions >------''',
-        'long_desc': '''''',
-        'example': '''''',
-        },
-    'list-cats': {
-        'func': 'listcats',
-        'options': [],
-        'desc': '''List seed file definitions (category names) found in the config''',
-        'long_desc': '''List seed file definitions (category names) found in the config.
-    These category names are used throughout the seed and key action operations.''',
-        'example': '''''',
-        },
-    'sign': {
-        'func': 'sign',
-        'options': ['nick', 'name', 'fingerprint', 'file', ],
-        'desc': '''Sign a file''',
-        'long_desc': '''Sign a file''',
-        'example': '''''',
-        },
-    'verify': {
-        'func': 'verify',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keydir', 'keys', '1file', 'signature', 'timestamp', 'dest'],
-        'desc': '''File automatic download and/or verification action.''',
-        'long_desc': '''File automatic download and/or verification action.
-    Note: If the specified key/keyring to verify against does not contain
-    the key used to sign the file.  It will Auto-search for the correct key
-    in the installed keys db. And verify against the matching key.
-    It will report the success/failure along with the key information used for
-    the verification''',
-        'example': '''''',
-        },
-    '----keys-----': {
-        'func': 'KEY_COMMANDS',
-        'options': [],
-        'desc': '''-------< key actions >--------''',
-        'long_desc': '',
-        'example': '',
-        },
-    'check-key': {
-        'func': 'checkkey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys', 'keydir', 'keyring'],
-        'desc': '''Check keys actions
-    Performs basic validity checks on the key(s), checks expiry,
-    and presence of a signing sub-key''',
-        'long_desc': '''Check keys actions
-    Performs basic validity checks on the key(s), checks expiry,
-    and presence of a signing sub-key''',
-        'example': '''''',
-        },
-    'import-key': {
-        'func': 'importkey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'keyring'],
-        'desc': '''Add a specified key to a specified keyring''',
-        'long_desc': '''Add a specified key to a specified keyring''',
-        'example': '''''',
-        },
-    'install-key': {
-        'func': 'installkey',
-        'options':  ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'keyring', '1file'],
-        'desc': '''Install a key from the seed(s)''',
-        'long_desc': '''Install a key from the seed(s)''',
-        'example': '''''',
-        },
-    'installed': {
-        'func': 'installed',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'keyring'],
-        'desc': '''Lists the installed key directories''',
-        'long_desc': '''Lists the installed key directories''',
-        'example': '''''',
-        },
-    'list-key': {
-        'func': 'listkey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys', 'keydir', 'keyring', 'gpgsearch'],
-        'desc': '''Pretty-print the selected gpg key''',
-        'long_desc': '''Pretty-print the selected gpg key''',
-        'example': '''''',
-        },
-    'move-key': {
-        'func': 'movekey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'keyring', 'dest'],
-        'desc': '''Rename an installed keydir''',
-        'long_desc': '''Rename an installed keydir''',
-        'example': '''''',
-        },
-    'refresh-key': {
-        'func': 'refreshkey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys', 'keydir', 'keyring'],
-        'desc': '''Calls gpg with the --refresh-keys option
-        for in place updates of the installed keys''',
-        'long_desc': '''Calls gpg with the --refresh-keys option
-        for in place updates of the installed keys''',
-        'example': '''''',
-        },
-    'remove-key': {
-        'func': 'removekey',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'keyring'],
-        'desc': '''Remove (uninstall) an installed key''',
-        'long_desc': '''Remove (uninstall) an installed key''',
-        'example': '''''',
-        },
-    'search-key': {
-        'func': 'key_search',
-        'options': ['category', 'nick', '1name', 'fingerprint', 'keyid', 'uid', 'keys', 'keydir', 'exact', 'all'],
-        'desc': '''Search for a key's seed in the installed keys db''',
-        'long_desc': '''Search for a key's seed in the installed keys db''',
-        'example': '''''',
-        },
-    'spec-check': {
-        'func': 'speccheck',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keyid', 'keys', 'keydir', 'keyring'],
-        'desc': '''Check if keys meet specifications requirements''',
-        'long_desc': '''Check if keys meet specifications requirements''',
-        'example': '''''',
-        },
-    '----seeds----': {
-        'func': 'SEED_COMMANDS',
-        'options': [],
-        'desc': '''------< seed actions >-------''',
-        'long_desc': '',
-        'example': '',
-        },
-    'add-seed': {
-        'func': 'addseed',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', 'uid'],
-        'desc': '''Add or replace a key in the selected seed file''',
-        'long_desc': '''Add or replace a key in the selected seed file''',
-        'example': '''''',
-        },
-    'fetch-seed': {
-        'func': 'fetchseed',
-        'options': ['category', 'nick', '1file', 'dest', 'signature', 'timestamp'],
-        'desc': '''Download the selected seed file(s)''',
-        'long_desc': '''Download the selected seed file(s)''',
-        'example': '''''',
-        },
-    'list-seed': {
-        'func': 'listseed',
-        'options': ['category', 'nick', 'name', 'fingerprint', 'keys', 'keydir', '1file'],
-        'desc': '''Pretty-print the selected seed file''',
-        'long_desc': '''Pretty-print the selected seed file''',
-        'example': '''''',
-        },
-    'list-seedfiles': {
-        'func': 'listseedfiles',
-        'options': [],
-        'desc': '''List seed files found in the configured seed directory''',
-        'long_desc': '''List seed files found in the configured seed directory''',
-        'example': '''''',
-        },
-    'move-seed': {
-        'func': 'moveseed',
-        'options': ['category', 'nick', 'name', 'keydir', 'keys', 'fingerprint', 'dest'],
-        'desc': '''Move keys between seed files''',
-        'long_desc': '''Move keys between seed files''',
-        'example': '''''',
-        },
-    'remove-seed': {
-        'func': 'removeseed',
-        'options': ['category', 'nick', 'name', 'keys', 'fingerprint', 'keydir'],
-        'desc': '''Remove a seed from the selected seed file''',
-        'long_desc': '''Remove a seed from the selected seed file''',
-        'example': '''''',
-        },
-})
-
-
 class Actions(object):
     '''Primary API actions'''
 

diff --git a/gkeys/gkeys/cli.py b/gkeys/gkeys/cli.py
index f266f6c..8ec45f9 100644
--- a/gkeys/gkeys/cli.py
+++ b/gkeys/gkeys/cli.py
@@ -17,7 +17,8 @@ import os
 import sys
 
 from gkeys.base import CliBase
-from gkeys.actions import Actions, Available_Actions, Action_Map
+from gkeys.actions import Actions
+from gkeys.action_map import Available_Actions, Action_Map
 from gkeys.config import GKeysConfig
 
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-05 23:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 18:37 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/, gkeys-ldap/gkeyldap/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-12-26 18:37 Brian Dolbec
2015-01-05 23:12 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox