← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~remy-leone/cloud-init:list_litteral into cloud-init:master

 

Sieben has proposed merging ~remy-leone/cloud-init:list_litteral into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~remy-leone/cloud-init/+git/cloud-init/+merge/340236
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~remy-leone/cloud-init:list_litteral into cloud-init:master.
diff --git a/cloudinit/cmd/main.py b/cloudinit/cmd/main.py
index d2f1b77..fcddd75 100644
--- a/cloudinit/cmd/main.py
+++ b/cloudinit/cmd/main.py
@@ -215,12 +215,10 @@ def main_init(name, args):
     if args.local:
         deps = [sources.DEP_FILESYSTEM]
 
-    early_logs = []
-    early_logs.append(
-        attempt_cmdline_url(
-            path=os.path.join("%s.d" % CLOUD_CONFIG,
-                              "91_kernel_cmdline_url.cfg"),
-            network=not args.local))
+    early_logs = [attempt_cmdline_url(
+        path=os.path.join("%s.d" % CLOUD_CONFIG,
+                          "91_kernel_cmdline_url.cfg"),
+        network=not args.local)]
 
     # Cloud-init 'init' stage is broken up into the following sub-stages
     # 1. Ensure that the init object fetches its config without errors
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index efedd4a..aff4010 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 35d8c57..98b0e66 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()
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index f87a343..b814c8b 100644
--- a/cloudinit/distros/arch.py
+++ b/cloudinit/distros/arch.py
@@ -129,11 +129,8 @@ class Distro(distros.Distro):
         if pkgs is None:
             pkgs = []
 
-        cmd = ['pacman']
+        cmd = ['pacman', "-Sy", "--quiet", "--noconfirm"]
         # Redirect output
-        cmd.append("-Sy")
-        cmd.append("--quiet")
-        cmd.append("--noconfirm")
 
         if args and isinstance(args, str):
             cmd.append(args)
diff --git a/cloudinit/distros/opensuse.py b/cloudinit/distros/opensuse.py
index a219e9f..162dfa0 100644
--- a/cloudinit/distros/opensuse.py
+++ b/cloudinit/distros/opensuse.py
@@ -67,11 +67,10 @@ class Distro(distros.Distro):
         if pkgs is None:
             pkgs = []
 
-        cmd = ['zypper']
         # No user interaction possible, enable non-interactive mode
-        cmd.append('--non-interactive')
+        cmd = ['zypper', '--non-interactive']
 
-        # Comand is the operation, such as install
+        # Command is the operation, such as install
         if command == 'upgrade':
             command = 'update'
         cmd.append(command)
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index ce47b6b..9450835 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -173,10 +173,7 @@ class OpenNebulaNetwork(object):
     def gen_conf(self):
         global_dns = self.context.get('DNS', "").split()
 
-        conf = []
-        conf.append('auto lo')
-        conf.append('iface lo inet loopback')
-        conf.append('')
+        conf = ['auto lo', 'iface lo inet loopback', '']
 
         for mac, dev in self.ifaces.items():
             mac = mac.lower()
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index d045268..bc4ebc8 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -132,8 +132,7 @@ class Init(object):
         return initial_dirs
 
     def purge_cache(self, rm_instance_lnk=False):
-        rm_list = []
-        rm_list.append(self.paths.boot_finished)
+        rm_list = [self.paths.boot_finished]
         if rm_instance_lnk:
             rm_list.append(self.paths.instance_link)
         for f in rm_list:
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 02dc2ce..b03b80c 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -716,8 +716,7 @@ def redirect_output(outfmt, errfmt, o_out=None, o_err=None):
 def make_url(scheme, host, port=None,
              path='', params='', query='', fragment=''):
 
-    pieces = []
-    pieces.append(scheme or '')
+    pieces = [scheme or '']
 
     netloc = ''
     if host:

Follow ups