update_etc_hosts broken for all distros but ubuntu

Bug #1100036 reported by Craig Tracey
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Craig Tracey

Bug Description

Right now hosts templates are named:
- hosts.redhat.tmpl
- hosts.ubuntu.tmpl

As the code is written such that it calls:
tpl_fn_name = cloud.get_template_filename("hosts.%s" %

This will only work for the 'ubuntu' distro.

Related branches

Changed in cloud-init:
assignee: nobody → Craig Tracey (craigtracey)
Revision history for this message
Tomas Karasek (tomas-karasek) wrote :

Hi, I am not sure if this is alrady addressed in the fix, but if you mark distro as "rhel" in /etc/cloud/cloud.cfg:
  distro: rhel

and enable update_etc_hosts module (which is enabled by default), you get:

2013-01-24 16:15:37,362 - cloud.py[WARNING]: No template found at /etc/cloud/templates/hosts.rhel.tmpl for template named hosts.rhel
2013-01-24 16:15:37,362 - util.py[WARNING]: Running update_etc_hosts (<module 'cloudinit.config.cc_update_etc_hosts' from '/usr/lib/python2.6/site-packages/cloudinit/config/cc_update_etc_hosts.pyc'>) failed

as there is no hosts.redhat.tmpl.

When I do
ln -s /etc/cloud/templates/hosts.redhat.tmpl /etc/cloud/templates/hosts.rhel.tmpl

and re-run update_etc_hosts, then it works properly

Revision history for this message
Craig Tracey (craigtracey) wrote :

Yes Tomas, that is correct. This fix addresses that specific problem.

Your workaround is the appropriate workaround until this fix is released.

Revision history for this message
Scott Moser (smoser) wrote :

fixed in trunk at revno 775.

Changed in cloud-init:
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote :

fixed in 0.7.2

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.