mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
This reverts commit 4349b56643
.
This commit is contained in:
parent
b6528ea19f
commit
ea18b9021a
15 changed files with 200 additions and 195 deletions
|
@ -127,8 +127,8 @@ import time
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.iosxr.iosxr import run_command, iosxr_argument_spec
|
||||
from ansible.module_utils.network.iosxr.iosxr import command_spec
|
||||
from ansible.module_utils.network.common.parsing import Conditional
|
||||
from ansible.module_utils.network.common.utils import to_list
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
@ -142,8 +142,11 @@ def to_lines(stdout):
|
|||
|
||||
def parse_commands(module, warnings):
|
||||
commands = module.params['commands']
|
||||
for item in to_list(commands):
|
||||
command = item['command']
|
||||
for item in list(commands):
|
||||
try:
|
||||
command = item['command']
|
||||
except Exception:
|
||||
command = item
|
||||
if module.check_mode and not command.startswith('show'):
|
||||
warnings.append(
|
||||
'only show commands are supported when using check mode, not '
|
||||
|
@ -160,14 +163,8 @@ def parse_commands(module, warnings):
|
|||
|
||||
|
||||
def main():
|
||||
command_spec = dict(
|
||||
command=dict(key=True),
|
||||
prompt=dict(),
|
||||
answer=dict()
|
||||
)
|
||||
|
||||
spec = dict(
|
||||
commands=dict(type='list', elements='dict', options=command_spec, required=True),
|
||||
commands=dict(type='list', required=True),
|
||||
|
||||
wait_for=dict(type='list', aliases=['waitfor']),
|
||||
match=dict(default='all', choices=['all', 'any']),
|
||||
|
@ -178,10 +175,13 @@ def main():
|
|||
|
||||
spec.update(iosxr_argument_spec)
|
||||
|
||||
spec.update(command_spec)
|
||||
|
||||
module = AnsibleModule(argument_spec=spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
warnings = list()
|
||||
|
||||
commands = parse_commands(module, warnings)
|
||||
|
||||
wait_for = module.params['wait_for'] or list()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue