summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/network/common/utils.py
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2019-05-28 12:19:34 -0400
committerGitHub <noreply@github.com>2019-05-28 12:19:34 -0400
commit532de89b449593d11168bfb5ac3fd89a91e52f33 (patch)
tree5250e1715d5689b5b27cfc75b48b5e05f865ddf8 /lib/ansible/module_utils/network/common/utils.py
parent1a893a48a3b25b1a12d4031c4bcbe80586a71f6f (diff)
downloadansible-532de89b449593d11168bfb5ac3fd89a91e52f33.tar.gz
Fix exception with load_provider function (#56959)
It is possible for provider.authorize to exist, but set to None. Rather then loading this value blindly, assume the default is False. File "/home/zuul/src/github.com/ansible/ansible/lib/ansible/executor/task_executor.py", line 145, in run res = self._execute() File "/home/zuul/src/github.com/ansible/ansible/lib/ansible/executor/task_executor.py", line 635, in _execute result = self._handler.run(task_vars=variables) File "/home/zuul/src/github.com/ansible/ansible/lib/ansible/plugins/action/ios.py", line 50, in run provider = load_provider(ios_provider_spec, self._task.args) File "/home/zuul/src/github.com/ansible/ansible/lib/ansible/module_utils/network/common/utils.py", line 424, in load_provider provider['authorize'] = boolean(provider['authorize']) File "/home/zuul/src/github.com/ansible/ansible/lib/ansible/module_utils/parsing/convert_bool.py", line 26, in boolean raise TypeError("The value '%s' is not a valid boolean. Valid booleans include: %s" % (to_text(value), ', '.join(repr(i) for i in BOOLEANS))) Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Diffstat (limited to 'lib/ansible/module_utils/network/common/utils.py')
-rw-r--r--lib/ansible/module_utils/network/common/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/network/common/utils.py b/lib/ansible/module_utils/network/common/utils.py
index 6e0a18d133..d939ed901f 100644
--- a/lib/ansible/module_utils/network/common/utils.py
+++ b/lib/ansible/module_utils/network/common/utils.py
@@ -421,7 +421,7 @@ def load_provider(spec, args):
provider[key] = None
if 'authorize' in provider:
# Coerce authorize to provider if a string has somehow snuck in.
- provider['authorize'] = boolean(provider['authorize'])
+ provider['authorize'] = boolean(provider['authorize'] or False)
args['provider'] = provider
return provider