monkeysphere: Fix handling of multiple domains and keys

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2019-02-09 12:27:57 -05:00
1 parent 722fa39c2a
commit 49640fdfce
2 files changed
+6 -6

No files matched your search

+3 -2
View File
@@ -21,6 +21,7 @@ Configuration helper for monkeysphere.
import argparse
import contextlib
import copy
import json
import os
import re
@@ -138,7 +139,7 @@ def get_monkeysphere_keys(key_id=None):
# parse output
default_dict = {'imported_domains': [], 'available_domains': []}
keys = [default_dict.copy()]
keys = [copy.deepcopy(default_dict)]
lines = output.decode().strip().split('\n')
for line in lines:
if line.startswith('pub'):
@@ -163,7 +164,7 @@ def get_monkeysphere_keys(key_id=None):
keys[-1]['ssh_fingerprint'] = data[1]
keys[-1]['ssh_key_type'] = data[2].strip('()')
elif line == '':
keys.append(default_dict.copy())
keys.append(copy.deepcopy(default_dict))
return {key['ssh_fingerprint']: key for key in keys}