summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2022-03-11 09:42:51 -0800
committerMatt Clay <matt@mystile.com>2022-03-11 12:24:44 -0800
commit1d8f9ce7d498c2f3476e396589783a0099366d1f (patch)
tree1e249e0a42a3663752c2f91909628d10a8c9cfdd
parent303d39a96658e608e1b0a2ee0554d7fc08f79882 (diff)
downloadansible-1d8f9ce7d498c2f3476e396589783a0099366d1f.tar.gz
[stable-2.9] ansible-test - Fix cloud plugin traceback.
(cherry picked from commit 7a8c6d74188b56228db77fed727cf1fdf3cc141d) Co-authored-by: Matt Clay <matt@mystile.com>
-rw-r--r--changelogs/fragments/ansible-test-remote-cloud-skip-traceback.yml2
-rw-r--r--test/lib/ansible_test/_internal/cloud/__init__.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/fragments/ansible-test-remote-cloud-skip-traceback.yml b/changelogs/fragments/ansible-test-remote-cloud-skip-traceback.yml
new file mode 100644
index 0000000000..6fcb9b9776
--- /dev/null
+++ b/changelogs/fragments/ansible-test-remote-cloud-skip-traceback.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - ansible-test - Fix an integration test traceback that occurs when some tests use cloud plugins, but all tests for at least one cloud plugin are skipped. (https://github.com/ansible/ansible/issues/75711)
diff --git a/test/lib/ansible_test/_internal/cloud/__init__.py b/test/lib/ansible_test/_internal/cloud/__init__.py
index 3ec6340730..efa9873d93 100644
--- a/test/lib/ansible_test/_internal/cloud/__init__.py
+++ b/test/lib/ansible_test/_internal/cloud/__init__.py
@@ -190,6 +190,9 @@ class CloudBase(ABC):
def config_callback(files): # type: (t.List[t.Tuple[str, str]]) -> None
"""Add the config file to the payload file list."""
+ if self.platform not in self.args.metadata.cloud_config:
+ return # callback registered, but plugin not initialized due to relevant tests being skipped
+
if self._get_cloud_config(self._CONFIG_PATH, ''):
if data_context().content.collection:
working_path = data_context().content.collection.directory