diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 29e078a3301..d67beb7fd8d 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -16,6 +16,7 @@ from distutils.version import StrictVersion from utils import find_globals +from ansible.plugins import module_loader from ansible.executor.module_common import REPLACER_WINDOWS from ansible.utils.module_docs import get_docstring, BLACKLIST_MODULES @@ -157,6 +158,9 @@ class ModuleValidator(Validator): def _is_bottom_import_blacklisted(self): return self.object_name in self.BOTTOM_IMPORTS_BLACKLIST + def _is_new_module(self): + return not module_loader.has_plugin(self.name) + def _check_interpreter(self, powershell=False): if powershell: if not self.text.startswith('#!powershell\n'): @@ -318,6 +322,9 @@ class ModuleValidator(Validator): 'function: %s' % ', '.join(redeclared)) def _check_version_added(self, doc): + if not self._is_new_module(): + return + try: version_added = StrictVersion(doc.get('version_added', '0.0')) except ValueError: