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>
pull/54993/head
Nilashish Chakraborty 6 years ago committed by GitHub
parent 4f0ad57934
commit 40507220b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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:

Loading…
Cancel
Save