diff options
author | Lars Kellogg-Stedman <lars@redhat.com> | 2016-12-06 21:13:24 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-12-19 14:29:37 -0500 |
commit | c01129492f046fdf745b432b6035605c9c613655 (patch) | |
tree | 5d7faa31701c6eaf83ea1f783424b80eee951013 /cloudinit/sources/__init__.py | |
parent | 39fb5a0240597112af8162c6c3365288450a7a77 (diff) | |
download | vyos-cloud-init-c01129492f046fdf745b432b6035605c9c613655.tar.gz vyos-cloud-init-c01129492f046fdf745b432b6035605c9c613655.zip |
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
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r-- | cloudinit/sources/__init__.py | 2 |
1 files changed, 2 insertions, 0 deletions
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: |