mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Add support for multiple prompt answers in network_cli (#44492)
* Currently network_cli support multiple prompts single answer as response. This PR adds support for multiple answers. * In case of multiple prompts and mulitple answers the index of a particular prompt in the prompts list should match with the index in the answer list.
This commit is contained in:
parent
24c26aded8
commit
e25d8e2b99
2 changed files with 9 additions and 3 deletions
|
@ -124,7 +124,10 @@ class CliconfBase(AnsiblePlugin):
|
|||
else:
|
||||
kwargs['prompt'] = to_bytes(prompt)
|
||||
if answer is not None:
|
||||
kwargs['answer'] = to_bytes(answer)
|
||||
if isinstance(answer, list):
|
||||
kwargs['answer'] = [to_bytes(p) for p in answer]
|
||||
else:
|
||||
kwargs['answer'] = to_bytes(answer)
|
||||
|
||||
resp = self._connection.send(**kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue