From 317ca7719373c799e1e25b13e248c24a2f518e32 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 10 Apr 2016 13:33:48 +0200 Subject: [PATCH] strip whitespace from key and value before inserting it into the config before the following would produce four entries: container_config: - "lxc.network.flags=up" - "lxc.network.flags =up" - "lxc.network.flags= up" - "lxc.network.flags = up" let's strip the whitespace and insert only one "lxc.network.flags = up" into the final config Signed-off-by: Evgeni Golov --- lib/ansible/modules/extras/cloud/lxc/lxc_container.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py index 678360afaec..425aedc7f99 100644 --- a/lib/ansible/modules/extras/cloud/lxc/lxc_container.py +++ b/lib/ansible/modules/extras/cloud/lxc/lxc_container.py @@ -745,6 +745,8 @@ class LxcContainerManagement(object): config_change = False for key, value in parsed_options: + key = key.strip() + value = value.strip() new_entry = '%s = %s\n' % (key, value) for option_line in container_config: # Look for key in config