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:41 -0800
commit2a15808cfcdb3bbfd13b828572606410f4b1dcb8 (patch)
tree60d990e399e71e091ea5443aa1e828233517a1ba
parentd708028e0795868f1af2db3d9102e3774cb418b8 (diff)
downloadansible-2a15808cfcdb3bbfd13b828572606410f4b1dcb8.tar.gz
[stable-2.10] 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 04f592c4e7..4a31ebcf31 100644
--- a/test/lib/ansible_test/_internal/cloud/__init__.py
+++ b/test/lib/ansible_test/_internal/cloud/__init__.py
@@ -197,6 +197,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, ''):
pair = (self.config_path, os.path.relpath(self.config_path, data_context().content.root))