mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Don't error on version_added for arg, if version_added should be the same as when the module was added. Fixes #18
This commit is contained in:
parent
113c74faac
commit
3842ae9ded
1 changed files with 7 additions and 4 deletions
|
@ -411,8 +411,8 @@ class ModuleValidator(Validator):
|
||||||
'number: %r' % version_added)
|
'number: %r' % version_added)
|
||||||
return
|
return
|
||||||
|
|
||||||
strict_ansible_version = StrictVersion(ansible_version)
|
|
||||||
should_be = '.'.join(ansible_version.split('.')[:2])
|
should_be = '.'.join(ansible_version.split('.')[:2])
|
||||||
|
strict_ansible_version = StrictVersion(should_be)
|
||||||
|
|
||||||
if (version_added < strict_ansible_version or
|
if (version_added < strict_ansible_version or
|
||||||
strict_ansible_version < version_added):
|
strict_ansible_version < version_added):
|
||||||
|
@ -423,6 +423,8 @@ class ModuleValidator(Validator):
|
||||||
if self._is_new_module():
|
if self._is_new_module():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
mod_version_added = StrictVersion(str(doc.get('version_added', '0.0')))
|
||||||
|
|
||||||
with CaptureStd():
|
with CaptureStd():
|
||||||
try:
|
try:
|
||||||
existing = module_loader.find_plugin(self.name, mod_type='.py')
|
existing = module_loader.find_plugin(self.name, mod_type='.py')
|
||||||
|
@ -441,8 +443,8 @@ class ModuleValidator(Validator):
|
||||||
|
|
||||||
options = doc.get('options', {})
|
options = doc.get('options', {})
|
||||||
|
|
||||||
strict_ansible_version = StrictVersion(ansible_version)
|
|
||||||
should_be = '.'.join(ansible_version.split('.')[:2])
|
should_be = '.'.join(ansible_version.split('.')[:2])
|
||||||
|
strict_ansible_version = StrictVersion(should_be)
|
||||||
|
|
||||||
for option, details in options.iteritems():
|
for option, details in options.iteritems():
|
||||||
new = not bool(existing_options.get(option))
|
new = not bool(existing_options.get(option))
|
||||||
|
@ -460,8 +462,9 @@ class ModuleValidator(Validator):
|
||||||
(option, version_added))
|
(option, version_added))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (version_added < strict_ansible_version or
|
if (strict_ansible_version != mod_version_added and
|
||||||
strict_ansible_version < version_added):
|
(version_added < strict_ansible_version or
|
||||||
|
strict_ansible_version < version_added)):
|
||||||
self.errors.append('version_added for new option (%s) should '
|
self.errors.append('version_added for new option (%s) should '
|
||||||
'be %s. Currently %s' %
|
'be %s. Currently %s' %
|
||||||
(option, should_be, version_added))
|
(option, should_be, version_added))
|
||||||
|
|
Loading…
Reference in a new issue