From 9b31175cf8601f469339f5b1760e358b236c40ff Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 22 Feb 2016 11:11:06 -0600 Subject: [PATCH] Get module version_added from existing, and catch invalid versions --- ansible_testing/modules.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 086c5f5bd0..721d4e1364 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -423,8 +423,6 @@ class ModuleValidator(Validator): if self._is_new_module(): return - mod_version_added = StrictVersion(str(doc.get('version_added', '0.0'))) - with CaptureStd(): try: existing = module_loader.find_plugin(self.name, mod_type='.py') @@ -441,6 +439,14 @@ class ModuleValidator(Validator): 'TRACE') return + + try: + mod_version_added = StrictVersion( + str(existing_doc.get('version_added', '0.0')) + ) + except ValueError: + mod_version_added = StrictVersion('0.0') + options = doc.get('options', {}) should_be = '.'.join(ansible_version.split('.')[:2])