ios_logging improvement (#57336)

* ios_logging: documentation update, add check for 'level' parameter

* ios_logging: add 'trap' destination
pull/55347/head
hexdump0x0200 5 years ago committed by Sumit Jaiswal
parent e0f6c17857
commit ae5d3d76f6

@ -38,7 +38,7 @@ options:
dest: dest:
description: description:
- Destination of the logs. - Destination of the logs.
choices: ['on', 'host', 'console', 'monitor', 'buffered'] choices: ['on', 'host', 'console', 'monitor', 'buffered', 'trap']
name: name:
description: description:
- If value of C(dest) is I(file) it indicates file-name, - If value of C(dest) is I(file) it indicates file-name,
@ -55,6 +55,8 @@ options:
level: level:
description: description:
- Set logging severity levels. - Set logging severity levels.
default: debugging
choices: ['emergencies', 'alerts', 'critical', 'errors', 'warnings', 'notifications', 'informational', 'debugging']
aggregate: aggregate:
description: List of logging definitions. description: List of logging definitions.
state: state:
@ -137,7 +139,7 @@ def validate_size(value, module):
def map_obj_to_commands(updates, module, os_version): def map_obj_to_commands(updates, module, os_version):
dest_group = ('console', 'monitor', 'buffered', 'on') dest_group = ('console', 'monitor', 'buffered', 'on', 'trap')
commands = list() commands = list()
want, have = updates want, have = updates
for w in want: for w in want:
@ -164,7 +166,7 @@ def map_obj_to_commands(updates, module, os_version):
commands.append('no logging {0}'.format(dest)) commands.append('no logging {0}'.format(dest))
else: else:
module.fail_json(msg='dest must be among console, monitor, buffered, host, on') module.fail_json(msg='dest must be among console, monitor, buffered, host, on, trap')
if facility: if facility:
commands.append('no logging facility {0}'.format(facility)) commands.append('no logging facility {0}'.format(facility))
@ -269,7 +271,7 @@ def parse_level(line, dest):
def map_config_to_obj(module): def map_config_to_obj(module):
obj = [] obj = []
dest_group = ('console', 'host', 'monitor', 'buffered', 'on', 'facility') dest_group = ('console', 'host', 'monitor', 'buffered', 'on', 'facility', 'trap')
data = get_config(module, flags=['| include logging']) data = get_config(module, flags=['| include logging'])
@ -374,11 +376,12 @@ def main():
""" main entry point for module execution """ main entry point for module execution
""" """
element_spec = dict( element_spec = dict(
dest=dict(type='str', choices=['on', 'host', 'console', 'monitor', 'buffered']), dest=dict(type='str', choices=['on', 'host', 'console', 'monitor', 'buffered', 'trap']),
name=dict(type='str'), name=dict(type='str'),
size=dict(type='int'), size=dict(type='int'),
facility=dict(type='str'), facility=dict(type='str'),
level=dict(type='str', default='debugging'), level=dict(type='str', default='debugging', choices=['emergencies', 'alerts', 'critical', 'errors', 'warnings',
'notifications', 'informational', 'debugging']),
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
) )

Loading…
Cancel
Save