diff options
author | Matt Martz <matt@sivel.net> | 2018-08-08 14:29:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 14:29:14 -0500 |
commit | 54e4c53f00d1dcc82b8e24497a686d31bb265b45 (patch) | |
tree | ebb556807b82506fedaaebc6779c3ed727a292a4 /test/sanity | |
parent | 35f625ee3b9a01b9e8fc7ffaea18457d77efa08a (diff) | |
download | ansible-54e4c53f00d1dcc82b8e24497a686d31bb265b45.tar.gz |
Ensure removed_in is StrictVersion before comparing (#43835)
* Ensure removed_in is StrictVersion before comparing
* Catch ValueError with StrictVersion on incompatible versions
Diffstat (limited to 'test/sanity')
-rwxr-xr-x | test/sanity/validate-modules/main.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/sanity/validate-modules/main.py b/test/sanity/validate-modules/main.py index 4f800e50e6..32f34fedb0 100755 --- a/test/sanity/validate-modules/main.py +++ b/test/sanity/validate-modules/main.py @@ -1374,10 +1374,14 @@ class ModuleValidator(Validator): # See if current version => deprecated.removed_in, ie, should be docs only if docs and 'deprecated' in docs and docs['deprecated'] is not None: - removed_in = docs.get('deprecated')['removed_in'] - strict_ansible_version = StrictVersion('.'.join(ansible_version.split('.')[:2])) - end_of_deprecation_should_be_docs_only = strict_ansible_version >= removed_in - # FIXME if +2 then file should be empty? - maybe add this only in the future + try: + removed_in = StrictVersion(str(docs.get('deprecated')['removed_in'])) + except ValueError: + end_of_deprecation_should_be_docs_only = False + else: + strict_ansible_version = StrictVersion('.'.join(ansible_version.split('.')[:2])) + end_of_deprecation_should_be_docs_only = strict_ansible_version >= removed_in + # FIXME if +2 then file should be empty? - maybe add this only in the future if self._python_module() and not self._just_docs() and not end_of_deprecation_should_be_docs_only: self._validate_ansible_module_call(docs) |