mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Fix structured output not supported in nxos_pim_interface (#28125)
* fixed unstructured error * fix unit tests so they accept commands in dictionary form
This commit is contained in:
parent
12460dd713
commit
a01aa6e9df
2 changed files with 12 additions and 3 deletions
|
@ -170,10 +170,17 @@ PARAM_TO_COMMAND_KEYMAP = {
|
||||||
|
|
||||||
|
|
||||||
def execute_show_command(command, module, text=False):
|
def execute_show_command(command, module, text=False):
|
||||||
if text is False:
|
if text:
|
||||||
command += ' | json'
|
cmds = [{
|
||||||
|
'command': command,
|
||||||
|
'output': 'text'
|
||||||
|
}]
|
||||||
|
else:
|
||||||
|
cmds = [{
|
||||||
|
'command': command,
|
||||||
|
'output': 'json'
|
||||||
|
}]
|
||||||
|
|
||||||
cmds = [command]
|
|
||||||
return run_commands(module, cmds)
|
return run_commands(module, cmds)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ class TestNxosIPInterfaceModule(TestNxosModule):
|
||||||
output = list()
|
output = list()
|
||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
if type(command) == dict:
|
||||||
|
command = command['command']
|
||||||
filename = str(command).split(' | ')[0].replace(' ', '_').replace('/', '_')
|
filename = str(command).split(' | ')[0].replace(' ', '_').replace('/', '_')
|
||||||
output.append(load_fixture(module_name, filename))
|
output.append(load_fixture(module_name, filename))
|
||||||
return output
|
return output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue