~harlowja/cloud-init/group-dict-fix

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_update_hostname.py

  • Committer: Joshua Harlow
  • Date: 2012-11-09 22:37:21 UTC
  • mfrom: (702.2.2 cloud-init)
  • Revision ID: harlowja@yahoo-inc.com-20121109223721-tq10b450d0n0l79v
Fix the fqdn/hostname case for rhel and ubuntu
where rhel uses the fqdn for its config while
ubuntu uses the short hostname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
                    " not updating the hostname in module %s"), name)
33
33
        return
34
34
 
35
 
    (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud)
 
35
    (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
36
36
    try:
37
37
        prev_fn = os.path.join(cloud.get_cpath('data'), "previous-hostname")
38
 
        cloud.distro.update_hostname(hostname, prev_fn)
 
38
        log.debug("Updating hostname to %s (%s)", fqdn, hostname)
 
39
        cloud.distro.update_hostname(hostname, fqdn, prev_fn)
39
40
    except Exception:
40
 
        util.logexc(log, "Failed to set the hostname to %s", hostname)
 
41
        util.logexc(log, "Failed to update the hostname to %s (%s)",
 
42
                    fqdn, hostname)
41
43
        raise