diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-09 14:37:21 -0800 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-09 14:37:21 -0800 |
| commit | a0f5926d6a238a71f96c6d5ddd617b5a3f78af46 (patch) | |
| tree | a26a5996b7e1deb404097c60216c979858b12969 /cloudinit/config | |
| parent | 2199cf29b48f3f9789ce108951121ac6e55c5d4c (diff) | |
| parent | bd01f3466e10ca515a8e8aec42d00201f40cbd53 (diff) | |
| download | vyos-cloud-init-a0f5926d6a238a71f96c6d5ddd617b5a3f78af46.tar.gz vyos-cloud-init-a0f5926d6a238a71f96c6d5ddd617b5a3f78af46.zip | |
Fix the fqdn/hostname case for rhel and ubuntu
where rhel uses the fqdn for its config while
ubuntu uses the short hostname.
Diffstat (limited to 'cloudinit/config')
| -rw-r--r-- | cloudinit/config/cc_set_hostname.py | 10 | ||||
| -rw-r--r-- | cloudinit/config/cc_update_hostname.py | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py index b0f27ebf..2b32fc94 100644 --- a/cloudinit/config/cc_set_hostname.py +++ b/cloudinit/config/cc_set_hostname.py @@ -27,9 +27,11 @@ def handle(name, cfg, cloud, log, _args): " not setting the hostname in module %s"), name) return - (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud) + (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud) try: - log.debug("Setting hostname to %s", hostname) - cloud.distro.set_hostname(hostname) + log.debug("Setting the hostname to %s (%s)", fqdn, hostname) + cloud.distro.set_hostname(hostname, fqdn) except Exception: - util.logexc(log, "Failed to set hostname to %s", hostname) + util.logexc(log, "Failed to set the hostname to %s (%s)", + fqdn, hostname) + raise 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 |
