Use RuntimeError subclass instead of top level Exception
This commit is contained in:
parent
38d516f2ec
commit
8f4786a3ba
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user