monkeysphere: Handle new format of uids in output

Older format was:
uid ssh://host

Newer format is:
uid [ something] ssh://host

I believe this change happened due to migration from gpg to gpg2. Adopt
our code to handle both cases.
This commit is contained in:
Sunil Mohan Adapa 2016-08-29 20:36:38 +05:30 committed by James Valleroy
parent f68e8612f1
commit 9b89fac9e1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -134,6 +134,9 @@ def get_monkeysphere_keys(key_id=None):
keys[-1]['date'] = data[1]
elif line.startswith('uid'):
uid = line.lstrip('uid').strip()
if uid.startswith('['):
uid = uid[uid.index(']') + 1:].strip()
keys[-1].setdefault('uids', []).append(uid)
matches = re.match('([a-zA-Z]*)://(.*)(:\d*)?', uid)
keys[-1]['service'] = matches.group(1)