diff options
Diffstat (limited to 'cloudinit/distros/rhel.py')
-rw-r--r-- | cloudinit/distros/rhel.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index 039215c8..7df01c62 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -48,6 +48,7 @@ class Distro(distros.Distro): clock_conf_fn = "/etc/sysconfig/clock" locale_conf_fn = '/etc/sysconfig/i18n' network_conf_fn = "/etc/sysconfig/network" + hostname_conf_fn = "/etc/sysconfig/network" network_script_tpl = '/etc/sysconfig/network-scripts/ifcfg-%s' resolve_conf_fn = "/etc/resolv.conf" tz_local_fn = "/etc/localtime" @@ -143,10 +144,6 @@ class Distro(distros.Distro): lines.insert(0, util.make_header()) util.write_file(fn, "\n".join(lines), 0644) - def set_hostname(self, hostname): - self._write_hostname(hostname, self.network_conf_fn) - self._apply_hostname(hostname) - def apply_locale(self, locale, out_fn=None): if not out_fn: out_fn = self.locale_conf_fn @@ -161,6 +158,13 @@ class Distro(distros.Distro): } self._update_sysconfig_file(out_fn, host_cfg) + def _select_hostname(self, hostname, fqdn): + # See: http://bit.ly/TwitgL + # Should be fqdn if we can use it + if fqdn: + return fqdn + return hostname + def _read_system_hostname(self): return (self.network_conf_fn, self._read_hostname(self.network_conf_fn)) |