Arg spec doc comparison fixes (#36265)

* Ensure we merge doc fragments early, for comparisons

* Perform boolean conversion from arg_spec data too

* Update valdiate-modules ignore.txt due to recent changes
pull/36178/merge
Matt Martz 6 years ago committed by John R Barker
parent 86918db312
commit 831a9d67d7

File diff suppressed because it is too large Load Diff

@ -1019,6 +1019,15 @@ class ModuleValidator(Validator):
if not self.analyze_arg_spec:
return
if docs is None:
docs = {}
try:
add_fragments(docs, self.object_path, fragment_loader=fragment_loader)
except Exception:
# Cannot merge fragments
return
try:
spec, args, kwargs = get_argument_spec(self.path)
except AnsibleModuleImportError as e:
@ -1061,12 +1070,15 @@ class ModuleValidator(Validator):
doc_default = docs.get('options', {}).get(arg, {}).get('default', None)
if data.get('type') == 'bool':
doc_default = maybe_convert_bool(doc_default)
if 'default' in data and data['default'] != doc_default:
arg_default = data.get('default')
if 'default' in data and data.get('type') == 'bool':
arg_default = maybe_convert_bool(data['default'])
if 'default' in data and arg_default != doc_default:
self.reporter.error(
path=self.object_path,
code=324,
msg=('Value for "default" from the argument_spec (%r) for "%s" does not match the '
'documentation (%r)' % (data['default'], arg, doc_default))
'documentation (%r)' % (arg_default, arg, doc_default))
)
doc_type = docs.get('options', {}).get(arg, {}).get('type', 'str')
@ -1087,12 +1099,6 @@ class ModuleValidator(Validator):
)
if docs:
try:
add_fragments(docs, self.object_path, fragment_loader=fragment_loader)
except Exception:
# Cannot merge fragments
return
file_common_arguments = set()
for arg, data in FILE_COMMON_ARGUMENTS.items():
file_common_arguments.add(arg)

Loading…
Cancel
Save