diff options
Diffstat (limited to 'cloudinit/config')
-rw-r--r-- | cloudinit/config/cc_final_message.py | 17 | ||||
-rw-r--r-- | cloudinit/config/cc_update_etc_hosts.py | 6 |
2 files changed, 10 insertions, 13 deletions
diff --git a/cloudinit/config/cc_final_message.py b/cloudinit/config/cc_final_message.py index b1caca47..3865332f 100644 --- a/cloudinit/config/cc_final_message.py +++ b/cloudinit/config/cc_final_message.py @@ -26,23 +26,20 @@ from cloudinit.settings import PER_ALWAYS frequency = PER_ALWAYS -FINAL_MESSAGE_DEF = ("Cloud-init v. {{version}} finished at {{timestamp}}." - " Up {{uptime}} seconds.") +# Cheetah formated default message +FINAL_MESSAGE_DEF = ("Cloud-init v. ${version} finished at ${timestamp}." + " Up ${uptime} seconds.") def handle(_name, cfg, cloud, log, args): - msg_in = None + msg_in = '' if len(args) != 0: - msg_in = args[0] + msg_in = str(args[0]) else: - msg_in = util.get_cfg_option_str(cfg, "final_message") - - if not msg_in: - template_fn = cloud.get_template_filename('final_message') - if template_fn: - msg_in = util.load_file(template_fn) + msg_in = util.get_cfg_option_str(cfg, "final_message". msg_in) + msg_in = msg_in.strip() if not msg_in: msg_in = FINAL_MESSAGE_DEF diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py index c148b12e..38108da7 100644 --- a/cloudinit/config/cc_update_etc_hosts.py +++ b/cloudinit/config/cc_update_etc_hosts.py @@ -36,11 +36,11 @@ def handle(name, cfg, cloud, log, _args): return # Render from a template file - distro_n = cloud.distro.name - tpl_fn_name = cloud.get_template_filename("hosts.%s" % (distro_n)) + tpl_fn_name = cloud.get_template_filename("hosts.%s" % + (cloud.distro.name)) if not tpl_fn_name: raise RuntimeError(("No hosts template could be" - " found for distro %s") % (distro_n)) + " found for distro %s") % (cloud.distro.name)) out_fn = cloud.paths.join(False, '/etc/hosts') templater.render_to_file(tpl_fn_name, out_fn, |