non-persistent hostname is the 'short' hostname

Bug #1246485 reported by alexius ludeman on 2013-10-30
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
cloud-init
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

alexius ludeman (lexinator) wrote :
Scott Moser (smoser) on 2014-07-28
Changed in cloud-init:
status: New → Triaged
importance: Undecided → Low
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. )

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).

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.

Scott Moser (smoser) wrote :

fix-committed in 1052

Changed in cloud-init:
status: Triaged → Fix Committed
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
Marc Tamsky (tamsky) wrote :

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

Robert Schweikert (rjschwei) wrote :

Yes fixed in 0.7.7

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers