mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Ensure removed_in is StrictVersion before comparing (#43835)
* Ensure removed_in is StrictVersion before comparing * Catch ValueError with StrictVersion on incompatible versions
This commit is contained in:
parent
35f625ee3b
commit
54e4c53f00
1 changed files with 8 additions and 4 deletions
|
@ -1374,10 +1374,14 @@ class ModuleValidator(Validator):
|
||||||
|
|
||||||
# See if current version => deprecated.removed_in, ie, should be docs only
|
# See if current version => deprecated.removed_in, ie, should be docs only
|
||||||
if docs and 'deprecated' in docs and docs['deprecated'] is not None:
|
if docs and 'deprecated' in docs and docs['deprecated'] is not None:
|
||||||
removed_in = docs.get('deprecated')['removed_in']
|
try:
|
||||||
strict_ansible_version = StrictVersion('.'.join(ansible_version.split('.')[:2]))
|
removed_in = StrictVersion(str(docs.get('deprecated')['removed_in']))
|
||||||
end_of_deprecation_should_be_docs_only = strict_ansible_version >= removed_in
|
except ValueError:
|
||||||
# FIXME if +2 then file should be empty? - maybe add this only in the future
|
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:
|
if self._python_module() and not self._just_docs() and not end_of_deprecation_should_be_docs_only:
|
||||||
self._validate_ansible_module_call(docs)
|
self._validate_ansible_module_call(docs)
|
||||||
|
|
Loading…
Reference in a new issue