summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-01-22 12:09:52 -0500
committerScott Moser <smoser@ubuntu.com>2015-01-22 12:09:52 -0500
commitde32623e6b34e3648958f1a08ef721ed9a03f2f8 (patch)
treed10ae9a3770fad0bdeb83a597523b8d30e259c9e /cloudinit/distros/__init__.py
parentc80892c9c326716724c3ff06d9a82516a4152c74 (diff)
parent8d453d2a4da4492857a4487b14fe7b11a014115b (diff)
downloadvyos-cloud-init-de32623e6b34e3648958f1a08ef721ed9a03f2f8.tar.gz
vyos-cloud-init-de32623e6b34e3648958f1a08ef721ed9a03f2f8.zip
merge from trunk
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r--cloudinit/distros/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index bf465442..5eab780b 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -86,7 +86,7 @@ class Distro(object):
def set_hostname(self, hostname, fqdn=None):
writeable_hostname = self._select_hostname(hostname, fqdn)
self._write_hostname(writeable_hostname, self.hostname_conf_fn)
- self._apply_hostname(hostname)
+ self._apply_hostname(writeable_hostname)
@abc.abstractmethod
def package_command(self, cmd, args=None, pkgs=None):
@@ -160,9 +160,12 @@ class Distro(object):
util.logexc(LOG, "Failed to non-persistently adjust the system "
"hostname to %s", hostname)
- @abc.abstractmethod
def _select_hostname(self, hostname, fqdn):
- raise NotImplementedError()
+ # Prefer the short hostname over the long
+ # fully qualified domain name
+ if not hostname:
+ return fqdn
+ return hostname
@staticmethod
def expand_osfamily(family_list):