diff --git a/changelogs/fragments/ansible-test-multi-win.yml b/changelogs/fragments/ansible-test-multi-win.yml new file mode 100644 index 00000000000..2e8b35d0545 --- /dev/null +++ b/changelogs/fragments/ansible-test-multi-win.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Fix traceback when requesting windows integration tests for multiple managed hosts. diff --git a/test/lib/ansible_test/_internal/commands/integration/filters.py b/test/lib/ansible_test/_internal/commands/integration/filters.py index 2be67dc0adc..74345cf866f 100644 --- a/test/lib/ansible_test/_internal/commands/integration/filters.py +++ b/test/lib/ansible_test/_internal/commands/integration/filters.py @@ -55,6 +55,11 @@ class TargetFilter[THostConfig: HostConfig](metaclass=abc.ABCMeta): self.allow_root = args.allow_root self.allow_destructive = args.allow_destructive + @property + def is_managed(self) -> bool: + """True if all configs are managed, otherwise False.""" + return all(config.is_managed for config in self.configs) + @property def config(self) -> THostConfig: """The configuration to filter. Only valid when there is a single config.""" @@ -104,7 +109,7 @@ class TargetFilter[THostConfig: HostConfig](metaclass=abc.ABCMeta): elif reason == FallbackReason.PYTHON: display.warning(f'Some {self.host_type} tests may be redundant since a fallback python is in use: {", ".join(affected_targets)}') - if not self.allow_destructive and not self.config.is_managed: + if not self.allow_destructive and not self.is_managed: override_destructive = set(target for target in self.include_targets if target.startswith('destructive/')) override = [target.name for target in targets if override_destructive & set(target.aliases)]