nxos_logging message fix (#49205)

* nxos_logging message fix

* Remove rescue in block
This commit is contained in:
Mike Wiebe 2018-11-28 00:07:04 -05:00 committed by Trishna Guha
parent dc871bd493
commit 374ca783bb
3 changed files with 28 additions and 9 deletions

View file

@ -74,7 +74,7 @@ options:
- Link/trunk enable/default interface configuration logging
choices: ['link-enable', 'link-default', 'trunk-enable', 'trunk-default']
version_added: '2.8'
message:
interface_message:
description:
- Add interface description to interface syslogs.
Does not work with version 6.0 images using nxapi as a transport.
@ -163,7 +163,7 @@ EXAMPLES = """
state: present
- name: Configure logging message ethernet description
nxos_logging:
message: add-interface-description
interface_message: add-interface-description
state: present
- name: Configure logging event link enable
nxos_logging:
@ -679,7 +679,7 @@ def map_params_to_obj(module):
'state': module.params['state'],
'facility_link_status': module.params['facility_link_status'],
'event': module.params['event'],
'message': module.params['message'],
'message': module.params['interface_message'],
'file_size': file_size,
'timestamp': module.params['timestamp']
})
@ -728,7 +728,7 @@ def main():
interface=dict(),
facility_link_status=dict(choices=['link-down-notif', 'link-down-error', 'link-up-notif', 'link-up-error']),
event=dict(choices=['link-enable', 'link-default', 'trunk-enable', 'trunk-default']),
message=dict(choices=['add-interface-description']),
interface_message=dict(choices=['add-interface-description']),
file_size=dict(type='int'),
timestamp=dict(choices=['microseconds', 'milliseconds', 'seconds']),
state=dict(default='present', choices=['present', 'absent']),

View file

@ -1,3 +1,13 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }
# Use block to ensure that the baude rate gets set
# back to 9600 even if there are failures or errors.
- block:
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }
always:
- name: Set Baud Rate Back to 9600 so our tests don't break
nxos_config:
lines:
- speed 9600
parents: line console
connection: network_cli

View file

@ -3,6 +3,15 @@
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# This task is needed to clear out any previous logfile
# size settings.
- name: Workaround to clear logging logfile size
nxos_config:
lines:
- logging logfile test 1 size 4194304
provider: "{{ connection }}"
ignore_errors: yes
- name: Purge logging configuration first
nxos_logging:
purge: true
@ -51,7 +60,7 @@
- name: Set Baud Rate to less than 38400
nxos_config:
lines:
- speed 9600
- speed 19200
parents: line console
provider: "{{ connection }}"
@ -263,7 +272,7 @@
- block:
- name: Configure Logging message
nxos_logging: &logm
message: add-interface-description
interface_message: add-interface-description
state: present
provider: "{{ connection }}"
register: result
@ -280,7 +289,7 @@
- name: Remove Logging message
nxos_logging:
message: add-interface-description
interface_message: add-interface-description
state: absent
provider: "{{ connection }}"
register: result