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

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_set_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:
27
27
                    " not setting the hostname in module %s"), name)
28
28
        return
29
29
 
30
 
    (hostname, _fqdn) = util.get_hostname_fqdn(cfg, cloud)
 
30
    (hostname, fqdn) = util.get_hostname_fqdn(cfg, cloud)
31
31
    try:
32
 
        log.debug("Setting hostname to %s", hostname)
33
 
        cloud.distro.set_hostname(hostname)
 
32
        log.debug("Setting the hostname to %s (%s)", fqdn, hostname)
 
33
        cloud.distro.set_hostname(hostname, fqdn)
34
34
    except Exception:
35
 
        util.logexc(log, "Failed to set hostname to %s", hostname)
 
35
        util.logexc(log, "Failed to set the hostname to %s (%s)",
 
36
                    fqdn, hostname)
 
37
        raise