ansible/test/integration/targets/ios_smoke/tests/cli/misc_tests.yaml
Ganesh Nalawade 97d4e53131
Support setting persistent command timeout per task basis (#42847)
* Support setting persistent command timeout per task basis

Fixes #42200

*  Add variable `ansible_command_timeout` to `persistent_command_timeout`
   option for `network_cli` and `netconf` connection plugin so that the
   command_timeout can be set per task basis while using `connection=network_cli`
   or `connection=netconf`
   eg:
   ```
   - name: run copy command
     ios_command:
       commands:
       - show version
     vars:
      ansible_command_timeout: 40
   ```

* Modify `ansible-connection` to read command_timeout value from
  connection plugin options.

* Add `ansible_command_timeout` to `persistent_command_timeout`
  option in `persistent` to support `connection=local` so that
  it is backward compatibilty

* To support `connection=local` pass the timeout value as variables
  from persistent connection to `ansible-connection` instead of sending
  it in playcontext

* Fix CI failure

* Fix review comment
2018-07-20 10:04:53 +05:30

40 lines
997 B
YAML

---
- debug: msg="START ios_smoke cli/misc_tests.yaml on connection={{ ansible_connection }}"
# hit network.ios.ios- get_defaults_flag()
- name: setup
ios_config:
commands:
- no description
- shutdown
parents:
- interface Loopback999
match: none
provider: "{{ cli }}"
- name: configure device with defaults included
ios_config:
src: defaults/config.j2
defaults: yes
provider: "{{ cli }}"
register: result
- name: run ios commands to test command_timeout
ios_command:
commands:
- show running-config all
- show interfaces
- show running-config all
vars:
ansible_command_timeout: 1
ignore_errors: True
register: result
when: ansible_connection == 'network_cli'
- assert:
that:
- 'result.failed == true'
- "'timeout trying to send command' in result.module_stderr"
when: ansible_connection == 'network_cli'
- debug: msg="END ios_smoke cli/misc_tests.yaml on connection={{ ansible_connection }}"