summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_apt_configure.py2
-rw-r--r--cloudinit/config/cc_bootcmd.py4
-rw-r--r--cloudinit/config/cc_disk_setup.py2
-rw-r--r--cloudinit/config/cc_emit_upstart.py2
-rw-r--r--cloudinit/config/cc_fan.py2
-rw-r--r--cloudinit/config/cc_final_message.py2
-rw-r--r--cloudinit/config/cc_grub_dpkg.py2
-rw-r--r--cloudinit/config/cc_keys_to_console.py2
-rw-r--r--cloudinit/config/cc_lxd.py2
-rw-r--r--cloudinit/config/cc_mounts.py10
-rw-r--r--cloudinit/config/cc_phone_home.py6
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py4
-rw-r--r--cloudinit/config/cc_runcmd.py2
-rw-r--r--cloudinit/config/cc_scripts_per_boot.py2
-rw-r--r--cloudinit/config/cc_scripts_per_instance.py2
-rw-r--r--cloudinit/config/cc_scripts_per_once.py2
-rw-r--r--cloudinit/config/cc_scripts_user.py2
-rw-r--r--cloudinit/config/cc_scripts_vendor.py2
-rw-r--r--cloudinit/config/cc_seed_random.py2
-rw-r--r--cloudinit/config/cc_set_passwords.py2
-rw-r--r--cloudinit/config/cc_snappy.py4
-rw-r--r--cloudinit/config/cc_ssh.py6
-rw-r--r--cloudinit/config/cc_ssh_import_id.py4
-rw-r--r--cloudinit/config/cc_ubuntu_init_switch.py4
24 files changed, 37 insertions, 37 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py
index dd199471..8f22c446 100644
--- a/cloudinit/config/cc_apt_configure.py
+++ b/cloudinit/config/cc_apt_configure.py
@@ -272,7 +272,7 @@ def add_sources(srclist, template_params=None, aa_repo_match=None):
try:
contents = "%s\n" % (source)
util.write_file(ent['filename'], contents, omode="ab")
- except:
+ except Exception:
errorlist.append([source,
"failed write to file %s" % ent['filename']])
diff --git a/cloudinit/config/cc_bootcmd.py b/cloudinit/config/cc_bootcmd.py
index a295cc4e..b763a3c3 100644
--- a/cloudinit/config/cc_bootcmd.py
+++ b/cloudinit/config/cc_bootcmd.py
@@ -38,7 +38,7 @@ def handle(name, cfg, cloud, log, _args):
content = util.shellify(cfg["bootcmd"])
tmpf.write(util.encode_text(content))
tmpf.flush()
- except:
+ except Exception:
util.logexc(log, "Failed to shellify bootcmd")
raise
@@ -49,6 +49,6 @@ def handle(name, cfg, cloud, log, _args):
env['INSTANCE_ID'] = str(iid)
cmd = ['/bin/sh', tmpf.name]
util.subp(cmd, env=env, capture=False)
- except:
+ except Exception:
util.logexc(log, "Failed to run bootcmd module %s", name)
raise
diff --git a/cloudinit/config/cc_disk_setup.py b/cloudinit/config/cc_disk_setup.py
index bbaf9646..b642f1f8 100644
--- a/cloudinit/config/cc_disk_setup.py
+++ b/cloudinit/config/cc_disk_setup.py
@@ -198,7 +198,7 @@ def is_device_valid(name, partition=False):
d_type = ""
try:
d_type = device_type(name)
- except:
+ except Exception:
LOG.warn("Query against device %s failed" % name)
return False
diff --git a/cloudinit/config/cc_emit_upstart.py b/cloudinit/config/cc_emit_upstart.py
index 86ae97ab..06c53272 100644
--- a/cloudinit/config/cc_emit_upstart.py
+++ b/cloudinit/config/cc_emit_upstart.py
@@ -20,8 +20,8 @@
import os
-from cloudinit.settings import PER_ALWAYS
from cloudinit import log as logging
+from cloudinit.settings import PER_ALWAYS
from cloudinit import util
frequency = PER_ALWAYS
diff --git a/cloudinit/config/cc_fan.py b/cloudinit/config/cc_fan.py
index 39e3850e..545fee22 100644
--- a/cloudinit/config/cc_fan.py
+++ b/cloudinit/config/cc_fan.py
@@ -37,8 +37,8 @@ If cloud-init sees a 'fan' entry in cloud-config it will
"""
from cloudinit import log as logging
-from cloudinit import util
from cloudinit.settings import PER_INSTANCE
+from cloudinit import util
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/config/cc_final_message.py b/cloudinit/config/cc_final_message.py
index 4a51476f..c9021eb1 100644
--- a/cloudinit/config/cc_final_message.py
+++ b/cloudinit/config/cc_final_message.py
@@ -66,7 +66,7 @@ def handle(_name, cfg, cloud, log, args):
try:
contents = "%s - %s - v. %s\n" % (uptime, ts, cver)
util.write_file(boot_fin_fn, contents)
- except:
+ except Exception:
util.logexc(log, "Failed to write boot finished file %s", boot_fin_fn)
if cloud.datasource.is_disconnected:
diff --git a/cloudinit/config/cc_grub_dpkg.py b/cloudinit/config/cc_grub_dpkg.py
index 3c2d9985..156722d9 100644
--- a/cloudinit/config/cc_grub_dpkg.py
+++ b/cloudinit/config/cc_grub_dpkg.py
@@ -69,5 +69,5 @@ def handle(name, cfg, _cloud, log, _args):
try:
util.subp(['debconf-set-selections'], dconf_sel)
- except:
+ except Exception:
util.logexc(log, "Failed to run debconf-set-selections for grub-dpkg")
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index aa844ee9..9a02f056 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -57,6 +57,6 @@ def handle(name, cfg, cloud, log, _args):
(stdout, _stderr) = util.subp(cmd)
util.multi_log("%s\n" % (stdout.strip()),
stderr=False, console=True)
- except:
+ except Exception:
log.warn("Writing keys to the system console failed!")
raise
diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py
index bf735648..b1de8f84 100644
--- a/cloudinit/config/cc_lxd.py
+++ b/cloudinit/config/cc_lxd.py
@@ -111,7 +111,7 @@ def handle(name, cfg, cloud, log, args):
data = "\n".join(["set %s %s" % (k, v)
for k, v in debconf.items()]) + "\n"
util.subp(['debconf-communicate'], data)
- except:
+ except Exception:
util.logexc(log, "Failed to run '%s' for lxd with" % dconf_comm)
# Remove the existing configuration file (forces re-generation)
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 4fe3ee21..2b981935 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -244,7 +244,7 @@ def handle_swapcfg(swapcfg):
LOG.debug("swap file %s already in use.", fname)
return fname
LOG.debug("swap file %s existed, but not in /proc/swaps", fname)
- except:
+ except Exception:
LOG.warn("swap file %s existed. Error reading /proc/swaps", fname)
return fname
@@ -379,7 +379,7 @@ def handle(_name, cfg, cloud, log, _args):
toks = WS.split(line)
if toks[3].find(comment) != -1:
continue
- except:
+ except Exception:
pass
fstab_lines.append(line)
@@ -390,16 +390,16 @@ def handle(_name, cfg, cloud, log, _args):
if needswap:
try:
util.subp(("swapon", "-a"))
- except:
+ except Exception:
util.logexc(log, "Activating swap via 'swapon -a' failed")
for d in dirs:
try:
util.ensure_dir(d)
- except:
+ except Exception:
util.logexc(log, "Failed to make '%s' config-mount", d)
try:
util.subp(("mount", "-a"))
- except:
+ except Exception:
util.logexc(log, "Activating mounts via 'mount -a' failed")
diff --git a/cloudinit/config/cc_phone_home.py b/cloudinit/config/cc_phone_home.py
index 3dcc9459..72176d42 100644
--- a/cloudinit/config/cc_phone_home.py
+++ b/cloudinit/config/cc_phone_home.py
@@ -65,7 +65,7 @@ def handle(name, cfg, cloud, log, args):
tries = ph_cfg.get('tries')
try:
tries = int(tries)
- except:
+ except Exception:
tries = 10
util.logexc(log, "Configuration entry 'tries' is not an integer, "
"using %s instead", tries)
@@ -87,7 +87,7 @@ def handle(name, cfg, cloud, log, args):
for (n, path) in pubkeys.items():
try:
all_keys[n] = util.load_file(path)
- except:
+ except Exception:
util.logexc(log, "%s: failed to open, can not phone home that "
"data!", path)
@@ -117,6 +117,6 @@ def handle(name, cfg, cloud, log, args):
util.read_file_or_url(url, data=real_submit_keys,
retries=tries, sec_between=3,
ssl_details=util.fetch_ssl_details(cloud.paths))
- except:
+ except Exception:
util.logexc(log, "Failed to post phone home data to %s in %s tries",
url, tries)
diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index 0ecf3a4d..8118fac4 100644
--- a/cloudinit/config/cc_rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
@@ -52,7 +52,7 @@ MY_HOOKNAME = 'CLOUD_INIT_REMOTE_HOOK'
def handle(name, _cfg, cloud, log, _args):
try:
ud = cloud.get_userdata_raw()
- except:
+ except Exception:
log.debug("Failed to get raw userdata in module %s", name)
return
@@ -63,7 +63,7 @@ def handle(name, _cfg, cloud, log, _args):
"did not find %s in parsed"
" raw userdata"), name, MY_HOOKNAME)
return
- except:
+ except Exception:
util.logexc(log, "Failed to parse query string %s into a dictionary",
ud)
raise
diff --git a/cloudinit/config/cc_runcmd.py b/cloudinit/config/cc_runcmd.py
index 66dc3363..bc09d38c 100644
--- a/cloudinit/config/cc_runcmd.py
+++ b/cloudinit/config/cc_runcmd.py
@@ -34,5 +34,5 @@ def handle(name, cfg, cloud, log, _args):
try:
content = util.shellify(cmd)
util.write_file(out_fn, content, 0o700)
- except:
+ except Exception:
util.logexc(log, "Failed to shellify %s into file %s", cmd, out_fn)
diff --git a/cloudinit/config/cc_scripts_per_boot.py b/cloudinit/config/cc_scripts_per_boot.py
index 42b987eb..ee3b6c9f 100644
--- a/cloudinit/config/cc_scripts_per_boot.py
+++ b/cloudinit/config/cc_scripts_per_boot.py
@@ -35,7 +35,7 @@ def handle(name, _cfg, cloud, log, _args):
runparts_path = os.path.join(cloud.get_cpath(), 'scripts', SCRIPT_SUBDIR)
try:
util.runparts(runparts_path)
- except:
+ except Exception:
log.warn("Failed to run module %s (%s in %s)",
name, SCRIPT_SUBDIR, runparts_path)
raise
diff --git a/cloudinit/config/cc_scripts_per_instance.py b/cloudinit/config/cc_scripts_per_instance.py
index b5d71c13..c0d62b12 100644
--- a/cloudinit/config/cc_scripts_per_instance.py
+++ b/cloudinit/config/cc_scripts_per_instance.py
@@ -35,7 +35,7 @@ def handle(name, _cfg, cloud, log, _args):
runparts_path = os.path.join(cloud.get_cpath(), 'scripts', SCRIPT_SUBDIR)
try:
util.runparts(runparts_path)
- except:
+ except Exception:
log.warn("Failed to run module %s (%s in %s)",
name, SCRIPT_SUBDIR, runparts_path)
raise
diff --git a/cloudinit/config/cc_scripts_per_once.py b/cloudinit/config/cc_scripts_per_once.py
index d77d36d5..ecb527f6 100644
--- a/cloudinit/config/cc_scripts_per_once.py
+++ b/cloudinit/config/cc_scripts_per_once.py
@@ -35,7 +35,7 @@ def handle(name, _cfg, cloud, log, _args):
runparts_path = os.path.join(cloud.get_cpath(), 'scripts', SCRIPT_SUBDIR)
try:
util.runparts(runparts_path)
- except:
+ except Exception:
log.warn("Failed to run module %s (%s in %s)",
name, SCRIPT_SUBDIR, runparts_path)
raise
diff --git a/cloudinit/config/cc_scripts_user.py b/cloudinit/config/cc_scripts_user.py
index 5c53014f..699857d1 100644
--- a/cloudinit/config/cc_scripts_user.py
+++ b/cloudinit/config/cc_scripts_user.py
@@ -36,7 +36,7 @@ def handle(name, _cfg, cloud, log, _args):
runparts_path = os.path.join(cloud.get_ipath_cur(), SCRIPT_SUBDIR)
try:
util.runparts(runparts_path)
- except:
+ except Exception:
log.warn("Failed to run module %s (%s in %s)",
name, SCRIPT_SUBDIR, runparts_path)
raise
diff --git a/cloudinit/config/cc_scripts_vendor.py b/cloudinit/config/cc_scripts_vendor.py
index 0c9e504e..80bf10ff 100644
--- a/cloudinit/config/cc_scripts_vendor.py
+++ b/cloudinit/config/cc_scripts_vendor.py
@@ -37,7 +37,7 @@ def handle(name, cfg, cloud, log, _args):
try:
util.runparts(runparts_path, exe_prefix=prefix)
- except:
+ except Exception:
log.warn("Failed to run module %s (%s in %s)",
name, SCRIPT_SUBDIR, runparts_path)
raise
diff --git a/cloudinit/config/cc_seed_random.py b/cloudinit/config/cc_seed_random.py
index 1b011216..5085c23a 100644
--- a/cloudinit/config/cc_seed_random.py
+++ b/cloudinit/config/cc_seed_random.py
@@ -24,8 +24,8 @@ import os
from six import BytesIO
-from cloudinit.settings import PER_INSTANCE
from cloudinit import log as logging
+from cloudinit.settings import PER_INSTANCE
from cloudinit import util
frequency = PER_INSTANCE
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index 58e1b713..5c8c23b8 100644
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -155,7 +155,7 @@ def handle(_name, cfg, cloud, log, args):
cmd = filter(None, cmd) # Remove empty arguments
util.subp(cmd)
log.debug("Restarted the ssh daemon")
- except:
+ except Exception:
util.logexc(log, "Restarting of the ssh daemon failed")
if len(errors):
diff --git a/cloudinit/config/cc_snappy.py b/cloudinit/config/cc_snappy.py
index fa9d54a0..1a485ee6 100644
--- a/cloudinit/config/cc_snappy.py
+++ b/cloudinit/config/cc_snappy.py
@@ -47,12 +47,12 @@ Example config:
"""
from cloudinit import log as logging
-from cloudinit import util
from cloudinit.settings import PER_INSTANCE
+from cloudinit import util
import glob
-import tempfile
import os
+import tempfile
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/config/cc_ssh.py b/cloudinit/config/cc_ssh.py
index d24e43c0..cb9b70aa 100644
--- a/cloudinit/config/cc_ssh.py
+++ b/cloudinit/config/cc_ssh.py
@@ -57,7 +57,7 @@ def handle(_name, cfg, cloud, log, _args):
for f in glob.glob(key_pth):
try:
util.del_file(f)
- except:
+ except Exception:
util.logexc(log, "Failed deleting key file %s", f)
if "ssh_keys" in cfg:
@@ -78,7 +78,7 @@ def handle(_name, cfg, cloud, log, _args):
with util.SeLinuxGuard("/etc/ssh", recursive=True):
util.subp(cmd, capture=False)
log.debug("Generated a key for %s from %s", pair[0], pair[1])
- except:
+ except Exception:
util.logexc(log, "Failed generated a key for %s from %s",
pair[0], pair[1])
else:
@@ -122,7 +122,7 @@ def handle(_name, cfg, cloud, log, _args):
keys.extend(cfgkeys)
apply_credentials(keys, user, disable_root, disable_root_opts)
- except:
+ except Exception:
util.logexc(log, "Applying ssh credentials failed!")
diff --git a/cloudinit/config/cc_ssh_import_id.py b/cloudinit/config/cc_ssh_import_id.py
index 2d480d7e..28c4585b 100644
--- a/cloudinit/config/cc_ssh_import_id.py
+++ b/cloudinit/config/cc_ssh_import_id.py
@@ -52,14 +52,14 @@ def handle(_name, cfg, cloud, log, args):
else:
try:
import_ids = user_cfg['ssh_import_id']
- except:
+ except Exception:
log.debug("User %s is not configured for ssh_import_id", user)
continue
try:
import_ids = util.uniq_merge(import_ids)
import_ids = [str(i) for i in import_ids]
- except:
+ except Exception:
log.debug("User %s is not correctly configured for ssh_import_id",
user)
continue
diff --git a/cloudinit/config/cc_ubuntu_init_switch.py b/cloudinit/config/cc_ubuntu_init_switch.py
index 7e88ed85..884d79f1 100644
--- a/cloudinit/config/cc_ubuntu_init_switch.py
+++ b/cloudinit/config/cc_ubuntu_init_switch.py
@@ -40,10 +40,10 @@ It can be configured with the following option structure::
mechanism you've used to switch the init system.
"""
-from cloudinit.settings import PER_INSTANCE
+from cloudinit.distros import ubuntu
from cloudinit import log as logging
+from cloudinit.settings import PER_INSTANCE
from cloudinit import util
-from cloudinit.distros import ubuntu
import os
import time