From 61a49e0420d470394ecc01c81b6e3e1fd7099262 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 22 Dec 2015 10:48:36 -0600 Subject: [PATCH] Only check version correctness on new modules. Fixes #11 --- ansible_testing/modules.py | 7 +++++++ 1 file changed, 7 insertions(+) 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: