From 8cef40f839510010ad83f70bd2bbe26aef2060e0 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 7 Oct 2021 09:18:32 -0700 Subject: [PATCH] ansible-test - Fix inventory path. --- changelogs/fragments/ansible-test-inventory-path.yaml | 2 ++ test/lib/ansible_test/_internal/cli/compat.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/ansible-test-inventory-path.yaml diff --git a/changelogs/fragments/ansible-test-inventory-path.yaml b/changelogs/fragments/ansible-test-inventory-path.yaml new file mode 100644 index 00000000000..3428ae2e3c0 --- /dev/null +++ b/changelogs/fragments/ansible-test-inventory-path.yaml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Fix path to inventory file for ``windows-integration`` and ``network-integration`` commands for collections. diff --git a/test/lib/ansible_test/_internal/cli/compat.py b/test/lib/ansible_test/_internal/cli/compat.py index b1ca08e39c5..cf6c01f1ef4 100644 --- a/test/lib/ansible_test/_internal/cli/compat.py +++ b/test/lib/ansible_test/_internal/cli/compat.py @@ -50,6 +50,10 @@ from ..host_configs import ( WindowsRemoteConfig, ) +from ..data import ( + data_context, +) + def filter_python(version, versions): # type: (t.Optional[str], t.Optional[t.List[str]]) -> t.Optional[str] """If a Python version is given and is in the given version list, return that Python version, otherwise return None.""" @@ -467,9 +471,9 @@ def default_targets( ): # type: (...) -> t.List[HostConfig] """Return a list of default targets for the given target mode.""" if mode == TargetMode.WINDOWS_INTEGRATION: - targets = [WindowsInventoryConfig(path=os.path.abspath('test/integration/inventory.winrm'))] + targets = [WindowsInventoryConfig(path=os.path.abspath(os.path.join(data_context().content.integration_path, 'inventory.winrm')))] elif mode == TargetMode.NETWORK_INTEGRATION: - targets = [NetworkInventoryConfig(path=os.path.abspath('test/integration/inventory.networking'))] + targets = [NetworkInventoryConfig(path=os.path.abspath(os.path.join(data_context().content.integration_path, 'inventory.networking')))] elif mode.multiple_pythons: targets = controller.get_default_targets(HostContext(controller_config=controller)) else: