mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
fix constructed functionality in openstack inventory plugin (#48833)
* test for openstack inventory constructed functionality this adds unit tests for the compose, groups, and keyed_var features of the openstack inventory plugin * fix constructed functionality in openstack inventory plugin The compose, groups, and keyed_groups functionality of the openstack inventory plugin was broken: - the plugin was not passing the correct variables to the Constructable methods for compose and groups - the plugin was simply never calling the appropriate method for implementing keyed_groups This commit fixes both issues.
This commit is contained in:
parent
abdf46803b
commit
bafc1f8a41
2 changed files with 96 additions and 2 deletions
|
@ -240,7 +240,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
|
||||
# create composite vars
|
||||
self._set_composite_vars(
|
||||
self._config_data.get('compose'), hostvars, host)
|
||||
self._config_data.get('compose'), hostvars[host], host)
|
||||
|
||||
# actually update inventory
|
||||
for key in hostvars[host]:
|
||||
|
@ -248,7 +248,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
|
||||
# constructed groups based on conditionals
|
||||
self._add_host_to_composed_groups(
|
||||
self._config_data.get('groups'), hostvars, host)
|
||||
self._config_data.get('groups'), hostvars[host], host)
|
||||
|
||||
# constructed groups based on jinja expressions
|
||||
self._add_host_to_keyed_groups(
|
||||
self._config_data.get('keyed_groups'), hostvars[host], host)
|
||||
|
||||
for group_name, group_hosts in groups.items():
|
||||
self.inventory.add_group(group_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue