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 authored and James Valleroy committed 2016-09-02 11:59:55 -04:00
1 parent f68e8612f1
commit 9b89fac9e1
1 file changed
+3
+3
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)