summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ssh_authkey_fingerprints.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-09-28 13:53:56 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-09-28 13:53:56 -0700
commitcf3dd1ba86d4ddde149f451e026c697c07b4d732 (patch)
tree29092b201054ca6af61c0c2f4ba61a8f28f051b0 /cloudinit/config/cc_ssh_authkey_fingerprints.py
parentdfa62e70bd9942fd3c82d77217d48615a78bbcfc (diff)
downloadvyos-cloud-init-cf3dd1ba86d4ddde149f451e026c697c07b4d732.tar.gz
vyos-cloud-init-cf3dd1ba86d4ddde149f451e026c697c07b4d732.zip
Rework the rest of the locations that used
the previous 'user' and make those locations go through the new distros functions to select the default user or the user list (depending on usage). Adjust the tests to check the new 'default' field that signifies the default user + test the new method to extract just the default user from a normalized user dictionary.
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)