|
|
|
@ -122,7 +122,6 @@ def validate_size(value, module):
|
|
|
|
|
def map_obj_to_commands(updates, module):
|
|
|
|
|
commands = list()
|
|
|
|
|
want, have = updates
|
|
|
|
|
|
|
|
|
|
for w in want:
|
|
|
|
|
dest = w['dest']
|
|
|
|
|
name = w['name']
|
|
|
|
@ -162,7 +161,6 @@ def map_obj_to_commands(updates, module):
|
|
|
|
|
dest_cmd += ' {}'.format(level)
|
|
|
|
|
|
|
|
|
|
commands.append(dest_cmd)
|
|
|
|
|
|
|
|
|
|
return commands
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -208,7 +206,7 @@ def parse_name(line, dest):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_level(line, dest):
|
|
|
|
|
level_group = ('emergencies', 'alerts', 'critical', 'errors', 'warnings',
|
|
|
|
|
level_group = ('emergencies', 'alerts', 'critical', 'errors', 'warning',
|
|
|
|
|
'notifications', 'informational', 'debugging')
|
|
|
|
|
|
|
|
|
|
if dest == 'hostnameprefix':
|
|
|
|
@ -228,25 +226,25 @@ def parse_level(line, dest):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def map_config_to_obj(module):
|
|
|
|
|
|
|
|
|
|
obj = []
|
|
|
|
|
dest_group = ('console', 'hostnameprefix', 'monitor', 'buffered', 'on')
|
|
|
|
|
|
|
|
|
|
data = get_config(module, flags=['logging'])
|
|
|
|
|
lines = data.split("\n")
|
|
|
|
|
|
|
|
|
|
for line in data.split('\n'):
|
|
|
|
|
|
|
|
|
|
for line in lines:
|
|
|
|
|
match = re.search(r'logging (\S+)', line, re.M)
|
|
|
|
|
|
|
|
|
|
if match.group(1) in dest_group:
|
|
|
|
|
dest = match.group(1)
|
|
|
|
|
else:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
obj.append({'dest': dest,
|
|
|
|
|
if match:
|
|
|
|
|
if match.group(1) in dest_group:
|
|
|
|
|
dest = match.group(1)
|
|
|
|
|
obj.append({
|
|
|
|
|
'dest': dest,
|
|
|
|
|
'name': parse_name(line, dest),
|
|
|
|
|
'size': parse_size(line, dest),
|
|
|
|
|
'facility': parse_facility(line),
|
|
|
|
|
'level': parse_level(line, dest)})
|
|
|
|
|
'level': parse_level(line, dest)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return obj
|
|
|
|
|
|
|
|
|
|