summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_ssh_authkey_fingerprints.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-09-27 21:30:01 -0400
committerScott Moser <smoser@ubuntu.com>2012-09-27 21:30:01 -0400
commitec910564e00498f5c545a227bee56eb25233e270 (patch)
treea256e433675284c2ae2f61e1ddf642bf284d25b3 /cloudinit/config/cc_ssh_authkey_fingerprints.py
parent317f442445fc40a666e9566e1f2739324cc99a2e (diff)
parent56d0585fd7d9804b82a1eb22faff8a6554b100b8 (diff)
downloadvyos-cloud-init-ec910564e00498f5c545a227bee56eb25233e270.tar.gz
vyos-cloud-init-ec910564e00498f5c545a227bee56eb25233e270.zip
cleanup the user/group lists
The primary utility here is normalize_user_groups, which would be called by config modules to get a list of users or groups. This centralizes what was copied code into this one location.
Diffstat (limited to 'cloudinit/config/cc_ssh_authkey_fingerprints.py')
-rw-r--r--cloudinit/config/cc_ssh_authkey_fingerprints.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py
index 23f5755a..2b9a6e0e 100644
--- a/cloudinit/config/cc_ssh_authkey_fingerprints.py
+++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py
@@ -21,6 +21,7 @@ import hashlib
from prettytable import PrettyTable
+from cloudinit import distros
from cloudinit import ssh_util
from cloudinit import util
@@ -89,8 +90,9 @@ def handle(name, cfg, cloud, log, _args):
log.debug(("Skipping module named %s, "
"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)
+ extract_func = ssh_util.extract_authorized_keys
+ (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)