Comment 0 for bug 1581200

Revision history for this message
Max Illfelder (illfelder) wrote : Ubuntu cloud-init expects trailing dot on metadata FQDN

cloud-init hostname breaks because /etc/hosts does not have the trailing dot on metadata FQDN.

Background:
On Ubuntu, cloud-init sets the hostname using our metadata service. To do this, it hits "metadata.google.internal." (note trailing dot) via HTTP.

We have entries in /etc/hosts for the metadata service to ensure that we can access it at boot time (if DNS is not yet up) as we have other init scripts which block bootup when metadata cannot be reached. However, these /etc/hosts entries only have "metadata.google.internal" (no trailing dot) entries.

When a customer runs their own bind9 daemon, it starts *after* cloud-init, meaning that cloud-init must use /etc/hosts to find the metadata service. When it cannot, it incorrectly sets the hostname to "$hostname.localdomain" instead of just $hostname.

Proposed fix:
Update:
http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/sources/DataSourceGCE.py

Line 28 should read:
'metadata_url': 'http://metadata.google.internal/computeMetadata/v1/'