diff --git a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py index c575e31e27..03dd134c6e 100644 --- a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py +++ b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py @@ -167,7 +167,7 @@ def execute_show_command(command, module, command_type='cli_show'): cmds = [command] body = run_commands(module, cmds) elif module.params['transport'] == 'nxapi': - cmds = [command] + cmds = {'command': command, 'output': 'text'} body = run_commands(module, cmds) return body @@ -208,7 +208,7 @@ def get_aaa_host_info(module, server_type, address): body = execute_show_command(command, module, command_type='cli_show_ascii') - if body: + if body[0]: try: pattern = ('(acct-port \d+)|(timeout \d+)|(auth-port \d+)|' '(key 7 "\w+")|( port \d+)') @@ -217,9 +217,8 @@ def get_aaa_host_info(module, server_type, address): 'auth-port': 'auth_port', 'port': 'tacacs_port', 'timeout': 'host_timeout'}) - if aaa_host_info: - aaa_host_info['server_type'] = server_type - aaa_host_info['address'] = address + aaa_host_info['server_type'] = server_type + aaa_host_info['address'] = address except TypeError: return {} else: