asa: Not all modules will have 'passwords' and 'context' keys (#54783)

* Add a check of passwords

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Add caution for context key as well

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Update lib/ansible/module_utils/network/asa/asa.py

Co-Authored-By: NilashishC <nilashishchakraborty8@gmail.com>

* Update lib/ansible/module_utils/network/asa/asa.py

Co-Authored-By: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
Nilashish Chakraborty 2019-04-03 21:42:34 +05:30 committed by GitHub
parent 4f0ad57934
commit 40507220b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,8 @@ def get_connection(module):
return _CONNECTION
_CONNECTION = Connection(module._socket_path)
context = module.params['context']
# Not all modules include the 'context' key.
context = module.params.get('context')
if context:
if context == 'system':
@ -130,7 +131,8 @@ def run_commands(module, commands, check_rc=True):
def get_config(module, flags=None):
flags = [] if flags is None else flags
passwords = module.params['passwords']
# Not all modules include the 'passwords' key.
passwords = module.params.get('passwords', False)
if passwords:
cmd = 'more system:running-config'
else: