diff --git a/lib/ansible/modules/network/nxos/nxos_pim_interface.py b/lib/ansible/modules/network/nxos/nxos_pim_interface.py index 6be6cdb8a92..07801c64ae4 100644 --- a/lib/ansible/modules/network/nxos/nxos_pim_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_pim_interface.py @@ -170,10 +170,17 @@ PARAM_TO_COMMAND_KEYMAP = { def execute_show_command(command, module, text=False): - if text is False: - command += ' | json' + if text: + cmds = [{ + 'command': command, + 'output': 'text' + }] + else: + cmds = [{ + 'command': command, + 'output': 'json' + }] - cmds = [command] return run_commands(module, cmds) diff --git a/test/units/modules/network/nxos/test_nxos_pim_interface.py b/test/units/modules/network/nxos/test_nxos_pim_interface.py index e3ad7b45b95..a7b5e2489a5 100644 --- a/test/units/modules/network/nxos/test_nxos_pim_interface.py +++ b/test/units/modules/network/nxos/test_nxos_pim_interface.py @@ -47,6 +47,8 @@ class TestNxosIPInterfaceModule(TestNxosModule): output = list() for command in commands: + if type(command) == dict: + command = command['command'] filename = str(command).split(' | ')[0].replace(' ', '_').replace('/', '_') output.append(load_fixture(module_name, filename)) return output