Do not output empty variables in inventory
Currently tripleo-ansible-inventory --static can create an invalid inventory file: The offending line appears to be: [undercloud] localhost ^ here Attempted to read "/home/stack/validations_static_inventory" as ini file: /home/stack/validations_static_inventory:11: Expected key=value, got: cacert The broken snippet can be: ... ansible_connection = local cacert undercloud_swift_url = https://192.168.24.2:13808/v1/AUTH_ab355edddba843deafef01bf520e8648 ... We need to make sure that keys that have a 'None' dictionary do not break the inventory file. Change-Id: I009c7b52a4d1dabc3ceaad14a828f90ff3845b94 Closes-Bug: #1701239
This commit is contained in:
parent
85b756973e
commit
8a2022e8a5
|
@ -92,7 +92,8 @@ def write_static_inventory(inventory_file_path, inventory):
|
|||
vars_section_name = "%s:%s" % (section_name, 'vars')
|
||||
config.add_section(vars_section_name)
|
||||
for var, value in section['vars'].items():
|
||||
config.set(vars_section_name, var, value)
|
||||
if value != None:
|
||||
config.set(vars_section_name, var, value)
|
||||
if 'children' in section:
|
||||
children_section_name = "%s:%s" % (section_name, 'children')
|
||||
config.add_section(children_section_name)
|
||||
|
|
Loading…
Reference in New Issue