Git has no options to set the git keydir or keyring.
Must set GNUPGHOME env variable to the desired keydir before
calling git log --show-signature to verify commits.
'name': 'cn',
'keyid': 'gpgkey',
'longkeyid': 'gpgkey',
- # map the uid to keyring, since we want
- # dev keyrings to be separate from each other
- 'keyring': 'uid',
+ # map the uid to keydir, since we want
+ # dev keydir to be separate from each other
+ 'keydir': 'uid',
'fingerprint': 'gpgfingerprint'
}
# Sanity check they are in sync
#failed = []
print(" GPG output:")
for key in keyresults:
- if not key.keyring and not args.nick == '*':
- self.logger.debug("ACTIONS: listkey; NO keyring... Ignoring")
+ if not key.keydir and not args.nick == '*':
+ self.logger.debug("ACTIONS: listkey; NO keydir... Ignoring")
return {"Failed: No keyid's found for %s" % key.name : ''}
- self.logger.debug("ACTIONS: listkey; listing keyring:"
- + str(key.keyring))
- results[key.name] = self.gpg.list_keys(key.keyring)
+ self.logger.debug("ACTIONS: listkey; listing keydir:"
+ + str(key.keydir))
+ results[key.name] = self.gpg.list_keys(key.keydir)
if self.config.options['print_results']:
print(results[key.name].output)
self.logger.debug("data output:\n" +
str(results[key.name].output))
#for result in results[key.name].status.data:
- #print("key desired:", key.name, ", keyring listed:",
+ #print("key desired:", key.name, ", keydir listed:",
#result)
#self.logger.debug("data record: " + str(result))
else:
return results
return {'done': True}
else:
- return {"No keyrings to list": False}
+ return {"No keydirs to list": False}
def addkey(self, args):
be hazardous to your system!''')
# actions
parser.add_argument('action', choices=actions, nargs='?',
- default='listseeds', help='Add to seed file or keyring')
+ default='listseeds', help='List the seeds in the file')
# options
parser.add_argument('-c', '--config', dest='config', default=None,
help='The path to an alternate config file')
parser.add_argument('-d', '--dest', dest='destination', default=None,
- help='The destination seed file or keyring for move, copy operations')
+ help='The destination seed file or keydir for move, copy operations')
parser.add_argument('-f', '--fingerprint', dest='fingerprint', default=None,
help='The fingerprint of the the key')
parser.add_argument('-N', '--name', dest='name', default=None,
help='The keyid of the the key')
parser.add_argument('-l', '--longkeyid', dest='longkeyid', default=None,
help='The longkeyid of the the key')
- parser.add_argument('-r', '--keyring',
- choices=['release', 'dev', 'overlays'], dest='keyring', default=None,
- help='The keyring to use or update')
+ parser.add_argument('-r', '--keydir',
+ choices=['release', 'dev', 'overlays'], dest='keydir', default=None,
+ help='The keydir to use or update')
parser.add_argument('-s', '--seeds',
choices=['release', 'dev'], dest='seeds', default=None,
help='The seeds file to use or update')
class GKEY(namedtuple('GKEY', ['nick', 'name', 'keyid', 'longkeyid',
- 'keyring', 'fingerprint'])):
+ 'keydir', 'fingerprint'])):
'''Class to hold the relavent info about a key'''
field_types = {'nick': str, 'name': str, 'keyid': list,
- 'longkeyid': list, 'keyring': str, 'fingerprint': list}
+ 'longkeyid': list, 'keydir': str, 'fingerprint': list}
field_separator = "|"
list_separator = ":"
__slots__ = ()
'''class init function
@param config: GKeysConfig config instance to use
- @param keyring: string, the path to the keydir to be used
+ @param keydir: string, the path to the keydir to be used
for all operations.
'''
GPG.__init__(self, config)
self.config = config
- self.keydir = keydir
+ self.basedir = keydir
+ self.keydir = None
self.task = None
self.task_value = None
self.task_value = None
+ def set_keydir(self, keydir):
+ logger.debug("basedir: %s, keydir: %s" % (self.basedir, keydir))
+ self.task = task
+ self.keydir = pjoin(self.basedir, keydir)
+ return
+
+
def add_key(self, gkey):
- '''Add the specified key to the specified keyring
+ '''Add the specified key to the specified keydir
@param gkey: GKEY namedtuple with
- (name, keyid/longkeyid, keyring, fingerprint,)
+ (name, keyid/longkeyid, keydir, fingerprint,)
'''
- self.set_keypath(gkey.keyring, self.config['tasks']['recv-keys'])
+ self.set_keydir(gkey.keydir)
# prefer the longkeyid if available
#logger.debug("LIB: add_key; keyids %s, %s"
return results
- def del_key(self, gkey, keyring):
- '''Delete the specified key to the specified keyring
+ def del_key(self, gkey, keydir):
+ '''Delete the specified key in the specified keydir
@param gkey: GKEY namedtuple with (name, keyid/longkeyid, fingerprint)
'''
return []
- def del_keyring(self, keyring):
- '''Delete the specified key to the specified keyring
+ def del_keydir(self, keydir):
+ '''Delete the specified keydir
'''
return []
- def update_key(self, gkey, keyring):
- '''Update the specified key in the specified keyring
+ def update_key(self, gkey, keydir):
+ '''Update the specified key in the specified keydir
@param key: tuple of (name, keyid, fingerprint)
- @param keyring: the keyring to add the key to
+ @param keydir: the keydir to add the key to
'''
return []
- def list_keys(self, keyring):
- '''List all keys in the specified keyring or
- all key in all keyrings if keyring=None
+ def list_keys(self, keydir):
+ '''List all keys in the specified keydir or
+ all keys in all keydir if keydir=None
- @param keyring: the keyring to add the key to
+ @param keydir: the keydir to list the keys for
'''
- if not keyring:
- logger.debug("LIB: list_keys(), invalid keyring parameter: %s"
- % str(keyring))
+ if not keydir:
+ logger.debug("LIB: list_keys(), invalid keydir parameter: %s"
+ % str(keydir))
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'])
+ self.set_keydir(keydir)
logger.debug("** Calling runGPG with Running 'gpg %s --list-keys %s'"
- % (' '.join(self.config['tasks']['list-keys']), keyring)
+ % (' '.join(self.config['tasks']['list-keys']), keydir)
)
- result = self.runGPG(task='list-keys', inputfile=keyring)
+ result = self.runGPG(task='list-keys')
logger.info('GPG return code: ' + str(result.returncode))
- self.reset_task()
+ #self.reset_task()
return result
- def list_keyrings(self):
- '''List all available keyrings
+ def list_keydirs(self):
+ '''List all available keydirs
'''
return []
def verify_key(self, gkey):
- '''verify the specified key from the specified keyring
+ '''verify the specified key from the specified keydir
@param gkey: GKEY namedtuple with (name, keyid/longkeyid, fingerprint)
'''