summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ssh_authkey_fingerprints.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config/cc_ssh_authkey_fingerprints.py')
-rw-r--r--cloudinit/config/cc_ssh_authkey_fingerprints.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py
index 2b9a6e0e..32214fba 100644
--- a/cloudinit/config/cc_ssh_authkey_fingerprints.py
+++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py
@@ -41,8 +41,10 @@ def _gen_fingerprint(b64_text, hash_meth='md5'):
hasher = hashlib.new(hash_meth)
hasher.update(base64.b64decode(b64_text))
return ":".join(_split_hash(hasher.hexdigest()))
- except TypeError:
+ except (TypeError, ValueError):
# Raised when b64 not really b64...
+ # or when the hash type is not really
+ # a known/supported hash type...
return '?'
@@ -95,4 +97,5 @@ def handle(name, cfg, cloud, log, _args):
(users, _groups) = distros.normalize_users_groups(cfg, cloud.distro)
for (user_name, _cfg) in users.items():
(auth_key_fn, auth_key_entries) = extract_func(user_name, cloud.paths)
- _pprint_key_entries(user_name, auth_key_fn, auth_key_entries, hash_meth)
+ _pprint_key_entries(user_name, auth_key_fn,
+ auth_key_entries, hash_meth)