Better fix for invalid data in 'options' field (#58353)

pull/58987/head
Sam Doran 5 years ago committed by GitHub
parent e8f4ebb22c
commit 36da7e462a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1178,13 +1178,13 @@ 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/'):
if data.get('options') and not isinstance(data.get('options'), Mapping): if data.get('options') is not None and not isinstance(data.get('options'), Mapping):
self.reporter.error( self.reporter.error(
path=self.object_path, path=self.object_path,
code=331, code=331,
msg="Argument 'options' in argument_spec['provider'] must be a dictionary/hash when used", msg="Argument 'options' in argument_spec['provider'] must be a dictionary/hash when used",
) )
else: elif data.get('options'):
# Record provider options from network modules, for later comparison # Record provider options from network modules, for later comparison
for provider_arg, provider_data in data.get('options', {}).items(): for provider_arg, provider_data in data.get('options', {}).items():
provider_args.add(provider_arg) provider_args.add(provider_arg)

Loading…
Cancel
Save