1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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 <evgeni@golov.de>
This commit is contained in:
Evgeni Golov 2016-04-10 13:33:48 +02:00 committed by Matt Clay
parent b4c3d32366
commit 317ca77193

View file

@ -745,6 +745,8 @@ class LxcContainerManagement(object):
config_change = False config_change = False
for key, value in parsed_options: for key, value in parsed_options:
key = key.strip()
value = value.strip()
new_entry = '%s = %s\n' % (key, value) new_entry = '%s = %s\n' % (key, value)
for option_line in container_config: for option_line in container_config:
# Look for key in config # Look for key in config