mirror of https://github.com/ansible/ansible.git
* Make banner detection non-greedy in ios_banner (#63092)
* Make banner detection non-greedy in ios_banner
* Added ios_banner unit test to detect bug #63091
* Corrected PEP8 errors
* Added integration test
* Corrected typo in integration test
(cherry picked from commit 01a92f0191)
* Added changelog fragment
* Update 66274-ios_banner_nongreedy.yml
Co-authored-by: kalimsshar <34369784+kalimsshar@users.noreply.github.com>
Co-authored-by: Matt Davis <nitzmahone@users.noreply.github.com>
pull/67297/head
parent
b390f808d9
commit
182831d8b0
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ios_banner - Modified the regular expression check to be non greedy when multiple banners are present.
|
||||
@ -0,0 +1,55 @@
|
||||
---
|
||||
|
||||
- name: Setup - set login and exec
|
||||
ios_banner:
|
||||
banner: "{{ item }}"
|
||||
text: |
|
||||
this is my login banner
|
||||
that as a multiline
|
||||
string
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
loop:
|
||||
- login
|
||||
- exec
|
||||
|
||||
|
||||
- name: Set login
|
||||
ios_banner:
|
||||
banner: "login"
|
||||
text: |
|
||||
this is my login banner
|
||||
that as a multiline
|
||||
string
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.commands | length == 0"
|
||||
|
||||
- name: Set exec
|
||||
ios_banner:
|
||||
banner: "exec"
|
||||
text: |
|
||||
this is my login banner
|
||||
that as a multiline
|
||||
string
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.commands | length == 0"
|
||||
@ -0,0 +1,15 @@
|
||||
banner exec ^C
|
||||
this is a sample
|
||||
mulitline banner
|
||||
used for testing
|
||||
^C
|
||||
banner login ^C
|
||||
this is a sample
|
||||
mulitline banner
|
||||
used for testing
|
||||
^C
|
||||
!
|
||||
dummy
|
||||
end
|
||||
of
|
||||
config
|
||||
Loading…
Reference in New Issue