From f1489a4d6f7e7ad73c542e7efe745d1696e9b504 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 3 Aug 2011 14:41:41 -0400 Subject: fix incorrect logic when 'manage_etc_hosts' has a value For better or worse, 'manage_etc_hosts' means "write /etc/hosts from the template" The default setting is 'False', which was not to update /etc/hosts at all. Now, we're updating /etc/hosts, claiming the 127.0.1.1 entry as owned by cloud-init if manage_etc_hosts is false. --- cloudinit/CloudConfig/cc_update_etc_hosts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudinit/CloudConfig/cc_update_etc_hosts.py b/cloudinit/CloudConfig/cc_update_etc_hosts.py index 60eba50e..6012b8a3 100644 --- a/cloudinit/CloudConfig/cc_update_etc_hosts.py +++ b/cloudinit/CloudConfig/cc_update_etc_hosts.py @@ -24,7 +24,8 @@ frequency = per_always def handle(name,cfg,cloud,log,args): ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud) - if util.get_cfg_option_bool(cfg,"manage_etc_hosts", True): + use_template = util.get_cfg_option_bool(cfg,"manage_etc_hosts", False) + if not use_template: # manage_etc_hosts not true, update the 127.0.1.1 entry via update_etc_hosts log.debug("manage_etc_hosts is not set, checking sanity of /etc/hosts") update_etc_hosts(hostname, fqdn, log) -- cgit v1.2.3