summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_update_etc_hosts.py
diff options
context:
space:
mode:
authorctracey <ctracey@craigtracey.com>2013-01-15 16:34:51 -0500
committerctracey <ctracey@craigtracey.com>2013-01-15 16:34:51 -0500
commit93bf045ce5e676a7568d3b14b175295b6ca38003 (patch)
tree714f94d71f85ecff72b73473f8d127401250ae23 /cloudinit/config/cc_update_etc_hosts.py
parent5d4f4df6804995d74e7962f60dcd72b26bcac69b (diff)
downloadvyos-cloud-init-93bf045ce5e676a7568d3b14b175295b6ca38003.tar.gz
vyos-cloud-init-93bf045ce5e676a7568d3b14b175295b6ca38003.zip
Fix broken cc_update_etc_hosts (LP: #1100036)
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 and is contingent upon support of 'osfamilies' as implemented in LP: #1100029 (lp:~craigtracey/cloud-init/osfamilies)
Diffstat (limited to 'cloudinit/config/cc_update_etc_hosts.py')
-rw-r--r--cloudinit/config/cc_update_etc_hosts.py5
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})