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:
Ganesh Nalawade 2018-08-23 19:16:42 +05:30 committed by Nathaniel Case
commit e25d8e2b99
2 changed files with 9 additions and 3 deletions

View file

@ -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)