summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorRémy Léone <rleone@online.net>2018-03-01 18:23:32 +0100
committerScott Moser <smoser@ubuntu.com>2018-03-02 12:53:26 -0500
commitffc6917aa0b97811c1e8503cd4cff9f11c15def1 (patch)
treebb2f58a42472a1d62cc9dfda544f7118a842b80a /cloudinit/config
parent40e77380e036a24fafe91a63d0cdefada4312348 (diff)
downloadvyos-cloud-init-ffc6917aa0b97811c1e8503cd4cff9f11c15def1.tar.gz
vyos-cloud-init-ffc6917aa0b97811c1e8503cd4cff9f11c15def1.zip
Change some list creation and population to literal.
This will provide a small performance improvement and shorter code.
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_keys_to_console.py4
-rwxr-xr-xcloudinit/config/cc_ssh_authkey_fingerprints.py9
2 files changed, 5 insertions, 8 deletions
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index efedd4ae..aff4010e 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -63,9 +63,7 @@ def handle(name, cfg, cloud, log, _args):
["ssh-dss"])
try:
- cmd = [helper_path]
- cmd.append(','.join(fp_blacklist))
- cmd.append(','.join(key_blacklist))
+ cmd = [helper_path, ','.join(fp_blacklist), ','.join(key_blacklist)]
(stdout, _stderr) = util.subp(cmd)
util.multi_log("%s\n" % (stdout.strip()),
stderr=False, console=True)
diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py
index 35d8c57f..98b0e665 100755
--- a/cloudinit/config/cc_ssh_authkey_fingerprints.py
+++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py
@@ -77,11 +77,10 @@ def _pprint_key_entries(user, key_fn, key_entries, hash_meth='md5',
tbl = SimpleTable(tbl_fields)
for entry in key_entries:
if _is_printable_key(entry):
- row = []
- row.append(entry.keytype or '-')
- row.append(_gen_fingerprint(entry.base64, hash_meth) or '-')
- row.append(entry.options or '-')
- row.append(entry.comment or '-')
+ row = [entry.keytype or '-',
+ _gen_fingerprint(entry.base64, hash_meth) or '-',
+ entry.options or '-',
+ entry.comment or '-']
tbl.add_row(row)
authtbl_s = tbl.get_string()
authtbl_lines = authtbl_s.splitlines()