mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
fixes ios and eos command modules (#20989)
* returns support for prompt/response over cli * now sends native dict instead of str command * fixes issue with run_commands() in ios to jsonify request * updates unit test cases
This commit is contained in:
parent
62c97cdd3e
commit
d226f31a0f
5 changed files with 8 additions and 10 deletions
|
@ -165,14 +165,14 @@ def to_lines(stdout):
|
|||
return lines
|
||||
|
||||
def parse_commands(module, warnings):
|
||||
cast = ComplexList(dict(
|
||||
transform = ComplexList(dict(
|
||||
command=dict(key=True),
|
||||
output=dict(),
|
||||
prompt=dict(),
|
||||
response=dict()
|
||||
))
|
||||
|
||||
commands = cast(module.params['commands'])
|
||||
commands = transform(module.params['commands'])
|
||||
|
||||
for index, item in enumerate(commands):
|
||||
if module.check_mode and not item['command'].startswith('show'):
|
||||
|
@ -180,6 +180,7 @@ def parse_commands(module, warnings):
|
|||
'Only show commands are supported when using check_mode, not '
|
||||
'executing %s' % item['command']
|
||||
)
|
||||
|
||||
return commands
|
||||
|
||||
def to_cli(obj):
|
||||
|
@ -223,8 +224,6 @@ def main():
|
|||
interval = module.params['interval']
|
||||
match = module.params['match']
|
||||
|
||||
commands = [to_cli(c) for c in commands]
|
||||
|
||||
while retries > 0:
|
||||
responses = run_commands(module, commands)
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ def parse_commands(module, warnings):
|
|||
response=dict()
|
||||
))
|
||||
commands = command(module.params['commands'])
|
||||
|
||||
for index, item in enumerate(commands):
|
||||
if module.check_mode and not item['command'].startswith('show'):
|
||||
warnings.append(
|
||||
|
@ -200,7 +199,6 @@ def parse_commands(module, warnings):
|
|||
msg='ios_command does not support running config mode '
|
||||
'commands. Please use ios_config instead'
|
||||
)
|
||||
commands[index] = module.jsonify(item)
|
||||
return commands
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue