Fixes eos_logging idempotence issue #31862 (#40604)

* eos_logging idempotence fix

* fixed eos_logging idempotence issue

* Fixed pylint and pep8 errors

* Added tests for eos_logging & minor fix

* Removed q statements
This commit is contained in:
Nilashish Chakraborty 2018-05-30 18:21:54 +05:30 committed by GitHub
commit b9ea646839
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 15 deletions

View file

@ -64,6 +64,7 @@
- 'result.changed == true'
- '"logging console warnings" in result.commands'
- name: Configure buffer size
eos_logging:
dest: buffered
@ -76,11 +77,42 @@
- 'result.changed == true'
- '"logging buffered 480000" in result.commands'
- name: Set up logging destination and facility at the same time
eos_logging:
dest: buffered
size: 4096
facility: local7
level: informational
state: present
become: yes
register: result
- assert:
that:
- 'result.changed == true'
- '"logging buffered 4096 informational" in result.commands'
- '"logging facility local7" in result.commands'
- name: Set up logging destination and facility at the same time again (idempotent)
eos_logging:
dest: buffered
size: 4096
facility: local7
level: informational
state: present
become: yes
register: result
- assert:
that:
- 'result.changed == false'
- name: remove logging as collection tearDown
eos_logging:
aggregate:
- { dest: console, level: warnings, state: absent }
- { dest: buffered, size: 480000, state: absent }
- { dest: buffered, level: informational, size: 4096, state: absent }
- { facility: local7, state: absent }
become: yes
register: result
@ -89,3 +121,4 @@
- 'result.changed == true'
- '"no logging console" in result.commands'
- '"no logging buffered" in result.commands'
- '"no logging facility local7" in result.commands'