mirror of https://github.com/ansible/ansible.git
eos_config module exit session gracefully
Fixes #36979 If `abort` is not issued in the top level session prompt the existing session goes to pending state. The fix is to come out of config mode by issuing `end` command and again to same config session and execute `abort` which `abort` is issued at the top level session prompt.pull/37244/head
parent
155adb1631
commit
017ea018d0
@ -0,0 +1,4 @@
|
||||
ip access-list test
|
||||
10 permit ip host 192.168.0.2 host 192.168.0.1
|
||||
20 permit ip host 192.168.0.1 host 192.168.0.2
|
||||
!
|
@ -0,0 +1,40 @@
|
||||
---
|
||||
- debug: msg="START cli/check_mode.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: invalid configuration in check mode
|
||||
eos_config:
|
||||
lines:
|
||||
- ip address 119.31.1.1 255.255.255.256
|
||||
parents: interface Loopback911
|
||||
check_mode: 1
|
||||
environment:
|
||||
ANSIBLE_EOS_USE_SESSIONS: 1
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.msg is defined"
|
||||
- "result.failed == true"
|
||||
- "'Error on executing commands' in result.msg"
|
||||
|
||||
- name: valid configuration in check mode
|
||||
eos_config:
|
||||
before:
|
||||
- "no ip access-list test"
|
||||
src: basic/cmds.j2
|
||||
check_mode: yes
|
||||
register: config
|
||||
|
||||
- name: check if session is removed
|
||||
eos_command:
|
||||
commands:
|
||||
- show configuration sessions | json
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "config.session not in result.stdout[0].sessions"
|
||||
|
||||
- debug: msg="END cli/check_mode.yaml on connection={{ ansible_connection }}"
|
Loading…
Reference in New Issue