Check that provider['options'] is a dictionary in validate-modules (#58078)
This commit is contained in:
parent
58d446e61a
commit
dc8f7b38e6
1 changed files with 11 additions and 4 deletions
|
@ -1177,10 +1177,17 @@ class ModuleValidator(Validator):
|
||||||
deprecated_args_from_argspec.add(arg)
|
deprecated_args_from_argspec.add(arg)
|
||||||
deprecated_args_from_argspec.update(data.get('aliases', []))
|
deprecated_args_from_argspec.update(data.get('aliases', []))
|
||||||
if arg == 'provider' and self.object_path.startswith('lib/ansible/modules/network/'):
|
if arg == 'provider' and self.object_path.startswith('lib/ansible/modules/network/'):
|
||||||
# Record provider options from network modules, for later comparison
|
if data.get('options') and not isinstance(data.get('options'), dict):
|
||||||
for provider_arg, provider_data in data.get('options', {}).items():
|
self.reporter.error(
|
||||||
provider_args.add(provider_arg)
|
path=self.object_path,
|
||||||
provider_args.update(provider_data.get('aliases', []))
|
code=331,
|
||||||
|
msg="Argument 'options' in argument_spec['provider'] must be a dictionary/hash when used",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Record provider options from network modules, for later comparison
|
||||||
|
for provider_arg, provider_data in data.get('options', {}).items():
|
||||||
|
provider_args.add(provider_arg)
|
||||||
|
provider_args.update(provider_data.get('aliases', []))
|
||||||
|
|
||||||
if data.get('required') and data.get('default', object) != object:
|
if data.get('required') and data.get('default', object) != object:
|
||||||
self.reporter.error(
|
self.reporter.error(
|
||||||
|
|
Loading…
Reference in a new issue