Skip to content

Commit

Permalink
Add simple regexp match for multiple prompt (#505)
Browse files Browse the repository at this point in the history
* Make changes to the correct file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update plugins/modules/cli_command.py

Co-authored-by: Kate Case <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add changelog fragement.

* Update changelogs/fragments/cli-command-module.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed docs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix lint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kate Case <[email protected]>
Co-authored-by: Vinay M <[email protected]>
Co-authored-by: roverflow <[email protected]>
  • Loading branch information
5 people authored Jul 19, 2024
1 parent b739f44 commit 55b18e1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/cli-command-module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
doc_changes:
- Add a simple regexp match example for multiple prompt with multiple answers.
This example could be used to for restarting a network device with a delay.
11 changes: 11 additions & 0 deletions docs/ansible.netcommon.cli_command_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ Examples
- <password>
- y
- name: Simple regexp match for multiple prompt, multiple answer(mandatory check for all prompts)
ansible.netcommon.cli_command:
command: reload in 5
check_all: true
prompt:
- Save\?
- confirm
answer:
- n
- y
Return Values
Expand Down
11 changes: 11 additions & 0 deletions plugins/modules/cli_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@
- y
- <password>
- y
- name: Simple regexp match for multiple prompt, multiple answer(mandatory check for all prompts)
ansible.netcommon.cli_command:
command: reload in 5
check_all: true
prompt:
- Save\\?
- confirm
answer:
- n
- y
"""

RETURN = """
Expand Down

0 comments on commit 55b18e1

Please sign in to comment.