diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | cloudinit/config/cc_ssh_authkey_fingerprints.py | 15 | ||||
-rw-r--r-- | config/cloud.cfg | 1 |
3 files changed, 10 insertions, 7 deletions
@@ -1,4 +1,5 @@ 0.7.0: + - write ssh authorized keys to console, ssh_authkey_fingerprints - Added RHEVm and vSphere support as source AltCloud [Joseph VLcek] - add write-files module (LP: #1012854) - Add setuptools + cheetah to debian package build dependencies (LP: #1022101) diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py index d4f136c2..35a68709 100644 --- a/cloudinit/config/cc_ssh_authkey_fingerprints.py +++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py @@ -17,14 +17,12 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import base64 -import glob import hashlib -import os from prettytable import PrettyTable -from cloudinit import util from cloudinit import ssh_util +from cloudinit import util FP_HASH_TYPE = 'md5' FP_SEGMENT_LEN = 2 @@ -34,7 +32,7 @@ FP_SEGMENT_SEP = ":" def _split_hash(bin_hash): split_up = [] for i in xrange(0, len(bin_hash), FP_SEGMENT_LEN): - split_up.append(bin_hash[i:i+FP_SEGMENT_LEN]) + split_up.append(bin_hash[i:i + FP_SEGMENT_LEN]) return split_up @@ -54,7 +52,8 @@ def _gen_fingerprint(b64_text): def _pprint_key_entries(user, key_fn, key_entries, prefix='ci-info: '): if not key_entries: - message = "%sno authorized ssh keys fingerprints found for user %s." % (prefix, user) + message = ("%sno authorized ssh keys fingerprints found for user %s." + % (prefix, user)) util.multi_log(message) return tbl_fields = ['Keytype', 'Fingerprint', 'Options', 'Comment'] @@ -69,7 +68,8 @@ def _pprint_key_entries(user, key_fn, key_entries, prefix='ci-info: '): authtbl_s = tbl.get_string() max_len = len(max(authtbl_s.splitlines(), key=len)) lines = [ - util.center("Authorized keys fingerprints from %s for user %s" % (key_fn, user), "+", max_len), + util.center("Authorized keys fingerprints from %s for user %s" % + (key_fn, user), "+", max_len), ] lines.extend(authtbl_s.splitlines()) for line in lines: @@ -82,5 +82,6 @@ def handle(name, cfg, cloud, log, _args): "logging of ssh fingerprints disabled"), name) user = util.get_cfg_option_str(cfg, "user", "ubuntu") - (auth_key_fn, auth_key_entries) = ssh_util.extract_authorized_keys(user, cloud.paths) + extract = ssh_util.extract_authorized_keys + (auth_key_fn, auth_key_entries) = extract(user, cloud.paths) _pprint_key_entries(user, auth_key_fn, auth_key_entries) diff --git a/config/cloud.cfg b/config/cloud.cfg index 2b4d9e63..f8d62e27 100644 --- a/config/cloud.cfg +++ b/config/cloud.cfg @@ -59,6 +59,7 @@ cloud_final_modules: - scripts-per-boot - scripts-per-instance - scripts-user + - ssh-auth-key-fingerprints - keys-to-console - phone-home - final-message |