Ensure 'authorize' is always bool, regardless of source (#56271)

This commit is contained in:
Nathaniel Case 2019-05-10 03:43:37 -04:00 committed by Nilashish Chakraborty
parent 8c56c116e5
commit 776ec08ad5

View file

@ -40,6 +40,7 @@ from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils.basic import AnsibleFallbackNotFound
from ansible.module_utils.parsing.convert_bool import boolean
# Backwards compatibility for 3rd party modules
from ansible.module_utils.common.network import (
@ -418,6 +419,9 @@ def load_provider(spec, args):
provider[key] = value['default']
else:
provider[key] = None
if 'authorize' in provider:
# Coerce authorize to provider if a string has somehow snuck in.
provider['authorize'] = boolean(provider['authorize'])
args['provider'] = provider
return provider