mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-01 04:30:22 -07:00
fix iosxr commands to encode json (#23346)
the command dict in the iosxr module_utils wasn't encoding the request to json. this patch will fix that problem
This commit is contained in:
parent
13dc02d49d
commit
f0008248d4
3 changed files with 2 additions and 3 deletions
|
@ -79,6 +79,7 @@ def run_commands(module, commands, check_rc=True):
|
||||||
responses = list()
|
responses = list()
|
||||||
commands = to_commands(module, to_list(commands))
|
commands = to_commands(module, to_list(commands))
|
||||||
for cmd in to_list(commands):
|
for cmd in to_list(commands):
|
||||||
|
cmd = module.jsonify(cmd)
|
||||||
rc, out, err = exec_command(module, cmd)
|
rc, out, err = exec_command(module, cmd)
|
||||||
if check_rc and rc != 0:
|
if check_rc and rc != 0:
|
||||||
module.fail_json(msg=err, rc=rc)
|
module.fail_json(msg=err, rc=rc)
|
||||||
|
|
|
@ -163,7 +163,6 @@ def parse_commands(module, warnings):
|
||||||
msg='iosxr_command does not support running config mode '
|
msg='iosxr_command does not support running config mode '
|
||||||
'commands. Please use iosxr_config instead'
|
'commands. Please use iosxr_config instead'
|
||||||
)
|
)
|
||||||
commands[index] = module.jsonify(item)
|
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -45,8 +45,7 @@ class TestIosxrCommandModule(TestIosxrModule):
|
||||||
|
|
||||||
for item in commands:
|
for item in commands:
|
||||||
try:
|
try:
|
||||||
obj = json.loads(item)
|
command = item['command']
|
||||||
command = obj['command']
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
command = item
|
command = item
|
||||||
filename = str(command).replace(' ', '_')
|
filename = str(command).replace(' ', '_')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue