diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-08 17:37:16 -0800 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-08 17:37:16 -0800 |
commit | b80c2401123e16b9038ff3fb6f6d660717ee68e1 (patch) | |
tree | c5f1d94c380961ea81644fbafb3218d16299ff4f /cloudinit/config/cc_update_hostname.py | |
parent | 6240367f1e87b077c81a8af2883cd4b50f64d76b (diff) | |
download | vyos-cloud-init-b80c2401123e16b9038ff3fb6f6d660717ee68e1.tar.gz vyos-cloud-init-b80c2401123e16b9038ff3fb6f6d660717ee68e1.zip |
Fix the case where on a redhat based system
the fully qualified domain name should end
up in /etc/sysconfig/network by passing the
fqdn to the update and set hostname methods
and using it accordingly.
LP: #1076759
Diffstat (limited to 'cloudinit/config/cc_update_hostname.py')
-rw-r--r-- | cloudinit/config/cc_update_hostname.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cloudinit/config/cc_update_hostname.py b/cloudinit/config/cc_update_hostname.py index 1d6679ea..52225cd8 100644 --- a/cloudinit/config/cc_update_hostname.py +++ b/cloudinit/config/cc_update_hostname.py @@ -32,10 +32,12 @@ def handle(name, cfg, cloud, log, _args): " not updating the hostname in module %s"), name) return - (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud) + (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud) try: prev_fn = os.path.join(cloud.get_cpath('data'), "previous-hostname") - cloud.distro.update_hostname(hostname, prev_fn) + log.debug("Updating hostname to %s (%s)", fqdn, hostname) + cloud.distro.update_hostname(hostname, fqdn, prev_fn) except Exception: - util.logexc(log, "Failed to set the hostname to %s", hostname) + util.logexc(log, "Failed to update the hostname to %s (%s)", + fqdn, hostname) raise |