fix: add composite vars to inventory

Docs seem to indicate compose variables should work, but they aren't actually set.
Fix that by adding the composite variables to the inventory.

Signed-off-by: matt <l3acon@gmail.com>
This commit is contained in:
matt
2024-04-08 10:26:27 -06:00
parent 95d07ce57b
commit c058de50cd

View File

@@ -604,6 +604,18 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
self.inventory.set_variable(
vmi_name, "vmi_volume_status", vmi_volume_status
)
self.set_composable_vars(vmi_name)
def set_composable_vars(self, vmi_name):
"""
set_composable_vars sets vars per
https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
"""
host_vars = self.inventory.get_host(vmi_name).get_vars()
strict = self.get_option("strict")
self._set_composite_vars(self.get_option("compose"), host_vars, vmi_name, strict=True)
self._add_host_to_composed_groups(self.get_option("groups"), host_vars, vmi_name, strict=strict)
self._add_host_to_keyed_groups(self.get_option("keyed_groups"), host_vars, vmi_name, strict=strict)
def get_ssh_services_for_namespace(self, client: K8SClient, namespace: str) -> Dict:
"""