FQDN does not get set correctly in /etc/hosts

Bug #812539 reported by Adam Gandelman
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned
cloud-init (Ubuntu)
Fix Released
Medium
Scott Moser

Bug Description

 `hostname -f` yields, for example, "ip-10-212-67-63.localdomain" on oneiric instead of "ip-10-212-67-63.ec2.internal" as expected. This causes obvious problems when instances are exporting hostnames to be used in configuration on other instances.

Related branches

description: updated
Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Rev 406 ( sanitize hosts file for system hostname (LP: #802637) ) attempts to set the hostname for 127.0.0.1 in /etc/hosts, however:

1. It is using a hard-coded domain of ".localdomain" instead of what is supplied by the cloud provider.
2. It is using platform.node() method to obtain its hostname when it should be using what is provided from cloud-init's data sources.

The following patch fixes this and allows hosts to boot with a valid FQDN as reported by the instance metadata.

Additionally, instances FQDN is included when propagating /etc/hosts from template.

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

As per discussion in #ubuntu-server, the following revised patch adheres to debian policy [1] with regards to populating /etc/hosts.

In absence of a hostname provided by a cloud metadata source, cc_update_etc_hosts.py will query platform.node() and construct a fqdn with a ".localhost" domain for 127.0.1.1 in /etc/hosts.

1. https://one.ubuntu.com/files/shareoffer/4f402554-ca48-4a0d-b133-47c4bf238415/

Revision history for this message
Adam Gandelman (gandelman-a) wrote :
Revision history for this message
Dave Walker (davewalker) wrote :

@Adam, thanks for raising this bug and working on a patch.

Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Scott Moser (smoser)
tags: added: server-o-rs
tags: added: patch
Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: Triaged → Fix Committed
Scott Moser (smoser)
Changed in cloud-init:
status: New → Fix Committed
Changed in cloud-init (Ubuntu):
status: Fix Committed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.1-0ubuntu12

---------------
cloud-init (0.6.1-0ubuntu12) oneiric; urgency=low

  * do not give trace on failure to resize in lxc container (LP: #800856)
  * increase the timeout on url gets for "seedfrom" values (LP: #812646)
  * do not write entries for ephemeral0 on t1.micro (LP: #744019)

  [Adam Gandalman]
  * improve the updating of /etc/hosts with correct fqdn when possible
    (LP: #812539)

  [Avishai Ish-Shalom]
  * add chef support (cloudinit/CloudConfig/cc_chef.py) (LP: #798844)
 -- Scott Moser <email address hidden> Thu, 21 Jul 2011 05:51:03 -0400

Changed in cloud-init (Ubuntu):
status: Triaged → Fix Released
Scott Moser (smoser)
Changed in cloud-init:
importance: Undecided → Medium
Scott Moser (smoser)
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.