diff options
author | harlowja <harlowja@virtualbox.rhel> | 2013-01-29 22:41:50 -0800 |
---|---|---|
committer | harlowja <harlowja@virtualbox.rhel> | 2013-01-29 22:41:50 -0800 |
commit | 7537cec4b6fdd27f9ad667f8b4682719b8da493c (patch) | |
tree | e15809e33a3d6dff2c59d85fbcf8e6db596cd8c0 /cloudinit | |
parent | 62f0f1745677e3422b12a9aaa96ba3e5452db94d (diff) | |
parent | 93bf045ce5e676a7568d3b14b175295b6ca38003 (diff) | |
download | vyos-cloud-init-7537cec4b6fdd27f9ad667f8b4682719b8da493c.tar.gz vyos-cloud-init-7537cec4b6fdd27f9ad667f8b4682719b8da493c.zip |
Fix broken cc_update_etc_hosts
Right now, all distros but ubuntu will fail to manage /etc/hosts.
This is due to the fact that the templates are named:
- hosts.ubuntu.tmpl
- hosts.redhat.tmpl
The config handler is specifically looking for a template with the
given distro name.
This change addresses this issue.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/config/cc_update_etc_hosts.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py index 96103615..d3dd1f32 100644 --- a/cloudinit/config/cc_update_etc_hosts.py +++ b/cloudinit/config/cc_update_etc_hosts.py @@ -37,10 +37,11 @@ def handle(name, cfg, cloud, log, _args): # Render from a template file tpl_fn_name = cloud.get_template_filename("hosts.%s" % - (cloud.distro.name)) + (cloud.distro.osfamily)) if not tpl_fn_name: raise RuntimeError(("No hosts template could be" - " found for distro %s") % (cloud.distro.name)) + " found for distro %s") % + (cloud.distro.osfamily)) templater.render_to_file(tpl_fn_name, '/etc/hosts', {'hostname': hostname, 'fqdn': fqdn}) |