From c01129492f046fdf745b432b6035605c9c613655 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Tue, 6 Dec 2016 21:13:24 -0500 Subject: set_hostname: avoid erroneously appending domain to fqdn In some situations, cloud-init will erroneously append a default domain to an already fully qualified hostname, resulting in something like 'localhost.localdomain.localdomain'. This patch checks to see if the value returned by util.get_hostname() contains a '.', and if it does treats it as a fully qualified name. Resolves: rhbz#1389048 LP: #1647910 --- cloudinit/sources/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py index 13fb7c62..ea05c4d4 100644 --- a/cloudinit/sources/__init__.py +++ b/cloudinit/sources/__init__.py @@ -194,6 +194,8 @@ class DataSource(object): fqdn = util.get_fqdn_from_hosts(hostname) if fqdn and fqdn.find(".") > 0: toks = str(fqdn).split(".") + elif hostname and hostname.find(".") > 0: + toks = str(hostname).split(".") elif hostname: toks = [hostname, defdomain] else: -- cgit v1.2.3