mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00: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:
committed by
Nathaniel Case
parent
24c26aded8
commit
e25d8e2b99
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user