diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-21 20:28:21 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-21 20:28:21 -0700 |
commit | 23cf7e35bf9aa1cffc9d1bb2f20d362b57110723 (patch) | |
tree | 70575a70f1c3f9431ad00ee5b7b886f01ef1b7ac /cloudinit | |
parent | a588b9b966e51c9b9778b0082c8c5b6ab10f2677 (diff) | |
download | vyos-cloud-init-23cf7e35bf9aa1cffc9d1bb2f20d362b57110723.tar.gz vyos-cloud-init-23cf7e35bf9aa1cffc9d1bb2f20d362b57110723.zip |
Use RuntimeError subclass instead of top level Exception
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/config/cc_landscape.py | 8 | ||||
-rw-r--r-- | cloudinit/config/cc_update_etc_hosts.py | 4 | ||||
-rw-r--r-- | cloudinit/distros/rhel.py | 4 | ||||
-rw-r--r-- | cloudinit/distros/ubuntu.py | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/cloudinit/config/cc_landscape.py b/cloudinit/config/cc_landscape.py index d45c9203..99a958b0 100644 --- a/cloudinit/config/cc_landscape.py +++ b/cloudinit/config/cc_landscape.py @@ -61,10 +61,10 @@ def handle(name, cfg, cloud, log, _args): ls_cloudcfg = cfg.get("landscape", {}) - if not isinstance(ls_cloudcfg, dict): - raise Exception(("'landscape' key existed in config," - " but not a dictionary type," - " is a %s instead"), util.obj_name(ls_cloudcfg)) + if not isinstance(ls_cloudcfg, (dict)): + raise RuntimeError(("'landscape' key existed in config," + " but not a dictionary type," + " is a %s instead"), util.obj_name(ls_cloudcfg)) merge_data = [ LSC_BUILTIN_CFG, diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py index 6820ac4f..c148b12e 100644 --- a/cloudinit/config/cc_update_etc_hosts.py +++ b/cloudinit/config/cc_update_etc_hosts.py @@ -39,8 +39,8 @@ def handle(name, cfg, cloud, log, _args): distro_n = cloud.distro.name tpl_fn_name = cloud.get_template_filename("hosts.%s" % (distro_n)) if not tpl_fn_name: - raise Exception(("No hosts template could be" - " found for distro %s") % (distro_n)) + raise RuntimeError(("No hosts template could be" + " found for distro %s") % (distro_n)) out_fn = cloud.paths.join(False, '/etc/hosts') templater.render_to_file(tpl_fn_name, out_fn, diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index df63d559..dff76075 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -208,8 +208,8 @@ class Distro(distros.Distro): def set_timezone(self, tz): tz_file = os.path.join("/usr/share/zoneinfo", tz) if not os.path.isfile(tz_file): - raise Exception(("Invalid timezone %s," - " no file found at %s") % (tz, tz_file)) + raise RuntimeError(("Invalid timezone %s," + " no file found at %s") % (tz, tz_file)) # Adjust the sysconfig clock zone setting read_fn = self._paths.join(True, "/etc/sysconfig/clock") old_contents = self._read_conf(read_fn) diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py index e8b95374..b23945d8 100644 --- a/cloudinit/distros/ubuntu.py +++ b/cloudinit/distros/ubuntu.py @@ -121,8 +121,8 @@ class Distro(distros.Distro): def set_timezone(self, tz): tz_file = os.path.join("/usr/share/zoneinfo", tz) if not os.path.isfile(tz_file): - raise Exception(("Invalid timezone %s," - " no file found at %s") % (tz, tz_file)) + raise RuntimeError(("Invalid timezone %s," + " no file found at %s") % (tz, tz_file)) tz_lines = [ "# Created by cloud-init", str(tz), |