← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1736174] Re: update_hostname module fails on CentOS/RHEL with systemd

 

** Bug watch added: Red Hat Bugzilla #1577947
   https://bugzilla.redhat.com/show_bug.cgi?id=1577947

** Also affects: cloud-init (CentOS) via
   https://bugzilla.redhat.com/show_bug.cgi?id=1577947
   Importance: Unknown
       Status: Unknown

** No longer affects: cloud-init (CentOS)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1736174

Title:
  update_hostname module fails on CentOS/RHEL with systemd

Status in cloud-init:
  New

Bug description:
  Cloud provider:  OpenStack

  #cloud-config
  hostname: somehostname.somedomain
  fqdn: somehostname.somedomain

   __init__.py[INFO]: /var/lib/cloud/data/previous-hostname differs from
  /etc/hostname, assuming user maintained hostname.

  Error message is a little bit misleading, since when uses_systemd(),
  /etc/hostname isn't actually read, instead, the result of
  util.subp(['hostname']) is used.

  Also, this comparison/test will never succeed, because when
  uses_systemd() and filename.endswitch('/previous-hostname'), the
  return is stripped of cr/lf, however, the result of
  util.subp(['hostname']) will contain a lf, and it is not being
  stripped:

  (from rhel.py)
  if self.uses_systemd() and filename.endswith('/previous-hostname'):
              return util.load_file(filename).strip()
          elif self.uses_systemd():
              (out, _err) = util.subp(['hostname'])
              if len(out):
                  return out
              else:
                  return default

  The simplest solution appears to be to add .strip() to return out; but
  this fix may have other implications.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1736174/+subscriptions


References