summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-08-03 14:41:41 -0400
committerScott Moser <smoser@ubuntu.com>2011-08-03 14:41:41 -0400
commitf1489a4d6f7e7ad73c542e7efe745d1696e9b504 (patch)
tree4901648710374eed6f2fb0d77de9acdc9554e07d
parent0b0a561413577392af4e408ae05348f2c7ebec04 (diff)
downloadvyos-cloud-init-f1489a4d6f7e7ad73c542e7efe745d1696e9b504.tar.gz
vyos-cloud-init-f1489a4d6f7e7ad73c542e7efe745d1696e9b504.zip
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.
-rw-r--r--cloudinit/CloudConfig/cc_update_etc_hosts.py3
1 files changed, 2 insertions, 1 deletions
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)