mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Fix cli_command multiple prompt issue (#44922)
* Add check in network_cli to handle all prompts * Add check_all flag to mandatory handle all the command prompt in prompts list. By default if any one prompt is handled remaining prompts are ignored. * Fix cli_command multiple prompt issue * If multiple prompt and answers are given as input network_cli handles only the first prompt that matched by default * If a command execution results in muliple prompt the fix add support to set a boolean option C(check_all) to indicate network_cli to wait till all the prompts and answers are processed. * Update cli_command * Update api doc * Fix unit test failure * Fix CI failure * Update network_cli * Fix review comment
This commit is contained in:
parent
cbd54a4b2c
commit
c0326aea2f
11 changed files with 65 additions and 33 deletions
|
@ -45,6 +45,14 @@ options:
|
|||
type: bool
|
||||
default: false
|
||||
required: false
|
||||
check_all:
|
||||
description:
|
||||
- By default if any one of the prompts mentioned in C(prompt) option is matched it won't check
|
||||
for other prompts. This boolean flag, that when set to I(True) will check for all the prompts
|
||||
mentioned in C(prompt) option in the given order. If the option is set to I(True) all the prompts
|
||||
should be received from remote host if not it will result in timeout.
|
||||
type: bool
|
||||
default: false
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
|
@ -73,9 +81,10 @@ EXAMPLES = """
|
|||
- set system syslog file test any any
|
||||
- exit
|
||||
|
||||
- name: multiple prompt, multiple answer
|
||||
- name: multiple prompt, multiple answer (mandatory check for all prompts)
|
||||
cli_command:
|
||||
command: "copy sftp sftp://user@host//user/test.img"
|
||||
check_all: True
|
||||
prompt:
|
||||
- "Confirm download operation"
|
||||
- "Password"
|
||||
|
@ -120,6 +129,7 @@ def main():
|
|||
prompt=dict(type='list', required=False),
|
||||
answer=dict(type='list', required=False),
|
||||
sendonly=dict(type='bool', default=False, required=False),
|
||||
check_all=dict(type='bool', default=False, required=False),
|
||||
)
|
||||
required_together = [['prompt', 'answer']]
|
||||
module = AnsibleModule(argument_spec=argument_spec, required_together=required_together,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue