Argument spec must be dict/hash (#40858)

validate-modules should fail when argument is not dict/hash.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-06-20 21:35:49 +05:30 committed by ansibot
parent c989b62eef
commit 27b85e732d
2 changed files with 8 additions and 0 deletions

View file

@ -117,6 +117,7 @@ Errors
328 Choices value from the documentation is not compatible with type defined in the argument_spec
329 Default value from the argument_spec is not compatible with type defined in the argument_spec
330 Choices value from the argument_spec is not compatible with type defined in the argument_spec
331 argument in argument_spec must be a dictionary/hash when used
..
--------- -------------------
**4xx** **Syntax**

View file

@ -1036,6 +1036,13 @@ class ModuleValidator(Validator):
args_from_argspec = set()
deprecated_args_from_argspec = set()
for arg, data in spec.items():
if not isinstance(data, dict):
self.reporter.error(
path=self.object_path,
code=331,
msg="argument '%s' in argument_spec must be a dictionary/hash when used" % arg,
)
continue
if not data.get('removed_in_version', None):
args_from_argspec.add(arg)
args_from_argspec.update(data.get('aliases', []))