nxos_logging message fix (#49205)

* nxos_logging message fix

* Remove rescue in block
pull/49229/head
Mike Wiebe 6 years ago committed by Trishna Guha
parent dc871bd493
commit 374ca783bb

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

@ -1,3 +1,13 @@
--- ---
# 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: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] } - { 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

@ -3,6 +3,15 @@
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" 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 - name: Purge logging configuration first
nxos_logging: nxos_logging:
purge: true purge: true
@ -51,7 +60,7 @@
- name: Set Baud Rate to less than 38400 - name: Set Baud Rate to less than 38400
nxos_config: nxos_config:
lines: lines:
- speed 9600 - speed 19200
parents: line console parents: line console
provider: "{{ connection }}" provider: "{{ connection }}"
@ -263,7 +272,7 @@
- block: - block:
- name: Configure Logging message - name: Configure Logging message
nxos_logging: &logm nxos_logging: &logm
message: add-interface-description interface_message: add-interface-description
state: present state: present
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
@ -280,7 +289,7 @@
- name: Remove Logging message - name: Remove Logging message
nxos_logging: nxos_logging:
message: add-interface-description interface_message: add-interface-description
state: absent state: absent
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result

Loading…
Cancel
Save