There are other instances of transform being used... update them as well (#45663)
This commit is contained in:
parent
a892a6ef03
commit
780dc9c561
4 changed files with 11 additions and 18 deletions
|
@ -413,8 +413,10 @@ def to_command(module, commands):
|
||||||
transform = ComplexList(dict(
|
transform = ComplexList(dict(
|
||||||
command=dict(key=True),
|
command=dict(key=True),
|
||||||
output=dict(default=default_output),
|
output=dict(default=default_output),
|
||||||
prompt=dict(),
|
prompt=dict(type='list'),
|
||||||
answer=dict()
|
answer=dict(type='list'),
|
||||||
|
sendonly=dict(type='bool', default=False),
|
||||||
|
check_all=dict(type='bool', default=False),
|
||||||
), module)
|
), module)
|
||||||
|
|
||||||
return transform(to_list(commands))
|
return transform(to_list(commands))
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_text
|
||||||
from ansible.module_utils.basic import env_fallback, return_values
|
from ansible.module_utils.basic import env_fallback
|
||||||
from ansible.module_utils.network.common.utils import to_list, ComplexList
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.connection import Connection, ConnectionError
|
from ansible.module_utils.connection import Connection, ConnectionError
|
||||||
|
|
||||||
_DEVICE_CONFIGS = {}
|
_DEVICE_CONFIGS = {}
|
||||||
|
@ -119,16 +119,6 @@ def get_config(module, flags=None):
|
||||||
return cfg
|
return cfg
|
||||||
|
|
||||||
|
|
||||||
def to_commands(module, commands):
|
|
||||||
spec = {
|
|
||||||
'command': dict(key=True),
|
|
||||||
'prompt': dict(),
|
|
||||||
'answer': dict()
|
|
||||||
}
|
|
||||||
transform = ComplexList(spec, module)
|
|
||||||
return transform(commands)
|
|
||||||
|
|
||||||
|
|
||||||
def run_commands(module, commands, check_rc=True):
|
def run_commands(module, commands, check_rc=True):
|
||||||
connection = get_connection(module)
|
connection = get_connection(module)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -488,8 +488,10 @@ def to_command(module, commands):
|
||||||
transform = ComplexList(dict(
|
transform = ComplexList(dict(
|
||||||
command=dict(key=True),
|
command=dict(key=True),
|
||||||
output=dict(default=default_output),
|
output=dict(default=default_output),
|
||||||
prompt=dict(),
|
prompt=dict(type='list'),
|
||||||
answer=dict()
|
answer=dict(type='list'),
|
||||||
|
sendonly=dict(type='bool', default=False),
|
||||||
|
check_all=dict(type='bool', default=False),
|
||||||
), module)
|
), module)
|
||||||
|
|
||||||
commands = transform(to_list(commands))
|
commands = transform(to_list(commands))
|
||||||
|
|
|
@ -158,7 +158,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.network.common.parsing import Conditional
|
from ansible.module_utils.network.common.parsing import Conditional
|
||||||
from ansible.module_utils.network.common.utils import transform_commands, to_lines
|
from ansible.module_utils.network.common.utils import transform_commands, to_lines
|
||||||
from ansible.module_utils.network.eos.eos import run_commands
|
from ansible.module_utils.network.eos.eos import run_commands
|
||||||
from ansible.module_utils.network.eos.eos import eos_argument_spec, check_args
|
from ansible.module_utils.network.eos.eos import eos_argument_spec
|
||||||
|
|
||||||
VALID_KEYS = ['command', 'output', 'prompt', 'response']
|
VALID_KEYS = ['command', 'output', 'prompt', 'response']
|
||||||
|
|
||||||
|
@ -205,7 +205,6 @@ def main():
|
||||||
|
|
||||||
warnings = list()
|
warnings = list()
|
||||||
result = {'changed': False, 'warnings': warnings}
|
result = {'changed': False, 'warnings': warnings}
|
||||||
check_args(module, warnings)
|
|
||||||
commands = parse_commands(module, warnings)
|
commands = parse_commands(module, warnings)
|
||||||
wait_for = module.params['wait_for'] or list()
|
wait_for = module.params['wait_for'] or list()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue