non-persistent hostname is the 'short' hostname

Bug #1246485 reported by alexius ludeman
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Low
Unassigned

Bug Description

Distro.set_hostname() uses wrong hostname when calling _apply_hostname().

On initial boot, the hostname is set to the short name, but after reboot it's set to the fqdn.

I happen to be using openstack(config_drive, or metadata) on RHEL(technically OEL6u3) however I don't think that matters much here.

Related branches

Revision history for this message
alexius ludeman (lexinator) wrote :
Scott Moser (smoser)
Changed in cloud-init:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Siert (sgz) wrote :

I am facing the exact same issue on CentOS 6.5 and RHEL 6.5 on AWS with cloud-init-7.4.2-2.el6.noarch from EPEL.

Before booting:

  [root@testcase6 ~]# hostname
  testcase6
  [root@testcase6 ~]# hostname -s
  testcase6
  [root@testcase6 ~]# hostname -f
  testcase6.deltaforce.io

After booting:

  [root@testcase6 ~]# hostname
  testcase6.deltaforce.io
  [root@testcase6 ~]# hostname -s
  testcase6
  [root@testcase6 ~]# hostname -f
  testcase6.deltaforce.io

Note the difference in the first hostname commands.

I will try/merge the submitted patch and see if that works for me.

( IMO hostname consitency before/after booting is important. In my situation this generates issues with tools like puppet/mcollective/etc. )

Revision history for this message
Siert (sgz) wrote :

Patch works for me. Not sure if it breaks on other systems. Attached patch works against cloud-init-0.7.4-2 (EPEL).

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :
Revision history for this message
Toni Ylenius (toni-ylenius) wrote :

Hi , we also bumped in to the bug and did same analysis as in Lars blog. There are two options,
either we use writable_hostname in _apply_hostname() (the patches above does this)
or we change _select_hostname() to pick the hostname without domain (as most of the other distro drivers seem to do).'

I vote option 2.

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

fix-committed in 1052

Changed in cloud-init:
status: Triaged → Fix Committed
Revision history for this message
Chirag Arora (chiragkarora) wrote :

I was trying to check the patch files and mistakenly made the status change. I apologize in advance.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
Marc Tamsky (tamsky) wrote :

Is this fixed or not? If not, please add a comment that directly declares the actual state.

Revision history for this message
Robert Schweikert (rjschwei) wrote :

Yes fixed in 0.7.7

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.