Specify vars after children sections
Changes how the vars and children sections are ordered in the generated static inventory by tripleo-ansible-inventory. Due to a change in ansible 2.4, having them in the opposite order caused no hosts to match the inventory. See also: https://github.com/ansible/ansible/issues/32196 Change-Id: I2aa1a04ea8a963b9c613008c12b1efffd365ceaf implements: blueprint ansible-config-download Closes-Bug: #1729058
This commit is contained in:
parent
bc3b90c2a8
commit
ff37e696c3
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fixes:
|
||||
- tripleo-ansible-inventory has been updated to output the vars sections
|
||||
after the children sections. Due to a change in ansible 2.4, having them
|
||||
in the other order caused no hosts to match the generated static inventory.
|
||||
See https://bugs.launchpad.net/tripleo/+bug/1729058
|
|
@ -90,17 +90,17 @@ def write_static_inventory(inventory_file_path, inventory):
|
|||
config.add_section(section_name)
|
||||
for host in section['hosts']:
|
||||
config.set(section_name, host)
|
||||
if 'children' in section:
|
||||
children_section_name = "%s:%s" % (section_name, 'children')
|
||||
config.add_section(children_section_name)
|
||||
for child in section['children']:
|
||||
config.set(children_section_name, child)
|
||||
if 'vars' in section:
|
||||
vars_section_name = "%s:%s" % (section_name, 'vars')
|
||||
config.add_section(vars_section_name)
|
||||
for var, value in section['vars'].items():
|
||||
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)
|
||||
for child in section['children']:
|
||||
config.set(children_section_name, child)
|
||||
config.write(inventory_file)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue