From b389b196c834e4eaf9020952a92cd471ced599d2 Mon Sep 17 00:00:00 2001 From: Dominic Schlegel Date: Thu, 15 Mar 2018 12:47:42 -0400 Subject: FreeBSD: Set hostname to FQDN. FreeBSD requires the hostname to be set to FQDN. Previously the hostname just got set to short hostname (without FQDN part). Now cloud-init does set the hostname to the FQDN on FreeBSD hosts if a valid FQDN is given. LP: #1753499 --- cloudinit/distros/freebsd.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cloudinit') diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index aa468bca..754d3df6 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -132,6 +132,12 @@ class Distro(distros.Distro): LOG.debug("Using network interface %s", bsddev) return bsddev + def _select_hostname(self, hostname, fqdn): + # Should be FQDN if available. See rc.conf(5) in FreeBSD + if fqdn: + return fqdn + return hostname + def _read_system_hostname(self): sys_hostname = self._read_hostname(filename=None) return ('rc.conf', sys_hostname) -- cgit v1.2.3