cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00870
[Merge] lp:~gfidente/cloud-init/try_fqdn_from_hosts into lp:cloud-init
Giulio Fidente has proposed merging lp:~gfidente/cloud-init/try_fqdn_from_hosts into lp:cloud-init.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~gfidente/cloud-init/try_fqdn_from_hosts/+merge/294680
In util.py , get_hostname_fqdn tries cloud.get_hostname(fqdn=True) to get the fqdn, but that might return just the hostname if fqdn isn't found.
This change is meant to make it try get_fqdn_from_hosts if fqdn does not contain any dot.
--
Your team cloud init development team is requested to review the proposed merge of lp:~gfidente/cloud-init/try_fqdn_from_hosts into lp:cloud-init.
=== modified file 'cloudinit/util.py'
--- cloudinit/util.py 2016-05-12 17:56:26 +0000
+++ cloudinit/util.py 2016-05-13 18:48:00 +0000
@@ -947,13 +947,17 @@
fqdn = cfg['hostname']
hostname = cfg['hostname'][:fqdn.find('.')]
else:
+ if "hostname" in cfg:
+ hostname = cfg['hostname']
+ else:
+ hostname = cloud.get_hostname()
# no fqdn set, get fqdn from cloud.
# get hostname from cfg if available otherwise cloud
fqdn = cloud.get_hostname(fqdn=True)
- if "hostname" in cfg:
- hostname = cfg['hostname']
- else:
- hostname = cloud.get_hostname()
+ if fqdn.find('.') < 1:
+ fqdn_from_hosts = get_fqdn_from_hosts(hostname)
+ if fqdn_from_hosts:
+ fqdn = fqdn_from_hosts
return (hostname, fqdn)
Follow ups