From 37f68bffc06842e91347a8db08990e5a08727fc0 Mon Sep 17 00:00:00 2001
From: rahushen <rahul.shenoy.86@gmail.com>
Date: Thu, 14 Sep 2017 12:29:53 -0400
Subject: [PATCH] fixes #27177 - nxos_aaa_server_host multiple issues (#29103)

---
 lib/ansible/modules/network/nxos/nxos_aaa_server_host.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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 c575e31e274..03dd134c6ec 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: