Fix cli_command junos test failure and update doc (#44021)

* Fix cli_command junos test failure and update doc

*  Fix cli_command module integration test failure
   for junos
*  Update cli_command module doc for prompt and
   config command run scenario's

* Update cli_command module doc
pull/44022/head
Ganesh Nalawade 6 years ago committed by GitHub
parent 0beae82f56
commit 24d112fc60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,6 +57,17 @@ EXAMPLES = """
command: commit replace command: commit replace
prompt: This commit will replace or remove the entire running configuration prompt: This commit will replace or remove the entire running configuration
answer: yes answer: yes
- name: run config mode command and handle prompt/answer
cli_command:
command: "{{ item }}"
prompt:
- "Exit with uncommitted changes"
answer: yes
loop:
- configure
- set system syslog file test any any
- exit
""" """
RETURN = """ RETURN = """

@ -2,28 +2,32 @@
- debug: - debug:
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}" msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- name: get output for single command - block:
cli_command: - name: get output for single command
commands: cli_command:
- show version command: show version
register: result register: result
- assert: - assert:
that: that:
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- name: get output for multiple commands - name: test with prompt and answer
cli_command: cli_command:
commands: command: "{{ item }}"
- show version prompt:
- show interfaces - "Exit with uncommitted changes"
register: result answer: yes
loop:
- configure
- set system syslog file test any any
- exit
register: result
- assert: - assert:
that: that:
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" when: ansible_connection == 'network_cli'
- "result.stdout | length == 2"
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"

Loading…
Cancel
Save