summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2013-01-29 22:41:50 -0800
committerharlowja <harlowja@virtualbox.rhel>2013-01-29 22:41:50 -0800
commit7537cec4b6fdd27f9ad667f8b4682719b8da493c (patch)
treee15809e33a3d6dff2c59d85fbcf8e6db596cd8c0
parent62f0f1745677e3422b12a9aaa96ba3e5452db94d (diff)
parent93bf045ce5e676a7568d3b14b175295b6ca38003 (diff)
downloadvyos-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.
-rw-r--r--ChangeLog1
-rw-r--r--cloudinit/config/cc_update_etc_hosts.py5
-rw-r--r--templates/hosts.debian.tmpl (renamed from templates/hosts.ubuntu.tmpl)0
3 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d750ac1..be861119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
- support grouping linux distros into "os_families". This allows a module
to operate on the family (redhat or debian) rather than the distro (ubuntu,
debian, fedora, rhel) (LP: #1100029)
+ - fix /etc/hosts writing when templates are used (LP: #1100036)
0.7.1:
- sysvinit: fix missing dependency in cloud-init job for RHEL 5.6
- config-drive: map hostname to local-hostname (LP: #1061964)
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})
diff --git a/templates/hosts.ubuntu.tmpl b/templates/hosts.debian.tmpl
index ae120b02..ae120b02 100644
--- a/templates/hosts.ubuntu.tmpl
+++ b/templates/hosts.debian.tmpl