summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2021-10-07 09:18:32 -0700
committerMatt Clay <matt@mystile.com>2021-10-07 11:16:43 -0700
commite2c4d046a99677f6495a94b1480984d0a66f7cf4 (patch)
tree9a96b6fec1ddf99cf2fb015d10f697b235b39eb6
parentd603412891c61256aca1bb799f76917742ac5250 (diff)
downloadansible-e2c4d046a99677f6495a94b1480984d0a66f7cf4.tar.gz
[stable-2.12] ansible-test - Fix inventory path.
(cherry picked from commit 8cef40f839510010ad83f70bd2bbe26aef2060e0) Co-authored-by: Matt Clay <matt@mystile.com>
-rw-r--r--changelogs/fragments/ansible-test-inventory-path.yaml2
-rw-r--r--test/lib/ansible_test/_internal/cli/compat.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/changelogs/fragments/ansible-test-inventory-path.yaml b/changelogs/fragments/ansible-test-inventory-path.yaml
new file mode 100644
index 0000000000..3428ae2e3c
--- /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 b1ca08e39c..cf6c01f1ef 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: