update_hostname module fails on CentOS/RHEL with systemd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Medium
|
Unassigned |
Bug Description
Cloud provider: OpenStack
#cloud-config
hostname: somehostname.
fqdn: somehostname.
__init__.py[INFO]: /var/lib/
Error message is a little bit misleading, since when uses_systemd(), /etc/hostname isn't actually read, instead, the result of util.subp(
Also, this comparison/test will never succeed, because when uses_systemd() and filename.
(from rhel.py)
if self.uses_systemd() and filename.
return util.load_
elif self.uses_
(out, _err) = util.subp(
if len(out):
else:
The simplest solution appears to be to add .strip() to return out; but this fix may have other implications.
no longer affects: | cloud-init (CentOS) |
I am currently preparing CentOS 7.5 Cloud Init images for my Linux trainings and am also affected by this bug. It might also be good to be able to disable this flaky auto detection, as there is already a config option `preserve_hostname` for preserving the hostname.