summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ssh_authkey_fingerprints.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-08-22 00:16:29 -0400
committerScott Moser <smoser@ubuntu.com>2012-08-22 00:16:29 -0400
commit49242c2a2e7e0ab6812de741b4ac2e8d1888ad08 (patch)
treef5eb4d21c640e9bde670a20476c8f2a452bc996b /cloudinit/config/cc_ssh_authkey_fingerprints.py
parente60058ce92b59883da221d3e889ed62bd9b69c14 (diff)
downloadvyos-cloud-init-49242c2a2e7e0ab6812de741b4ac2e8d1888ad08.tar.gz
vyos-cloud-init-49242c2a2e7e0ab6812de741b4ac2e8d1888ad08.zip
fix pylint in cc_ssh_authkey_fingerprints.py
Diffstat (limited to 'cloudinit/config/cc_ssh_authkey_fingerprints.py')
-rw-r--r--cloudinit/config/cc_ssh_authkey_fingerprints.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py
index 68684c3d..81d6e89e 100644
--- a/cloudinit/config/cc_ssh_authkey_fingerprints.py
+++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py
@@ -47,18 +47,21 @@ def _gen_fingerprint(b64_text, hash_meth='md5'):
def _is_printable_key(entry):
if any([entry.keytype, entry.base64, entry.comment, entry.options]):
- if entry.keytype and entry.keytype.lower().strip() in ['ssh-dss', 'ssh-rsa']:
+ if (entry.keytype and
+ entry.keytype.lower().strip() in ['ssh-dss', 'ssh-rsa']):
return True
return False
-def _pprint_key_entries(user, key_fn, key_entries, hash_meth='md5', prefix='ci-info: '):
+def _pprint_key_entries(user, key_fn, key_entries, hash_meth='md5',
+ prefix='ci-info: '):
if not key_entries:
message = ("%sno authorized ssh keys fingerprints found for user %s."
% (prefix, user))
util.multi_log(message)
return
- tbl_fields = ['Keytype', 'Fingerprint (%s)' % (hash_meth), 'Options', 'Comment']
+ tbl_fields = ['Keytype', 'Fingerprint (%s)' % (hash_meth), 'Options',
+ 'Comment']
tbl = PrettyTable(tbl_fields)
for entry in key_entries:
if _is_printable_key(entry):
@@ -87,6 +90,7 @@ def handle(name, cfg, cloud, log, _args):
"logging of ssh fingerprints disabled"), name)
user_name = util.get_cfg_option_str(cfg, "user", "ubuntu")
+ hash_meth = util.get_cfg_option_str(cfg, "authkey_hash", "md5")
extract = ssh_util.extract_authorized_keys
(auth_key_fn, auth_key_entries) = extract(user_name, cloud.paths)
_pprint_key_entries(user_name, auth_key_fn, auth_key_entries, hash_meth)