- Fix logging module issue where facility is being deleted along with host (#32234)
- Remove default facility, as facility is not standard on remote syslog serverpull/4420/head
parent
9752ce368d
commit
7d5dccefe5
|
@ -179,12 +179,12 @@ def map_obj_to_commands(updates, module):
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
def parse_facility(line):
|
def parse_facility(line, dest):
|
||||||
match = re.search(r'logging facility (\S+)', line, re.M)
|
facility = None
|
||||||
if match:
|
if dest == 'facility':
|
||||||
facility = match.group(1)
|
match = re.search(r'logging facility (\S+)', line, re.M)
|
||||||
else:
|
if match:
|
||||||
facility = 'local7'
|
facility = match.group(1)
|
||||||
|
|
||||||
return facility
|
return facility
|
||||||
|
|
||||||
|
@ -242,7 +242,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')
|
dest_group = ('console', 'host', 'monitor', 'buffered', 'on', 'facility')
|
||||||
|
|
||||||
data = get_config(module, flags=['| section logging'])
|
data = get_config(module, flags=['| section logging'])
|
||||||
|
|
||||||
|
@ -256,10 +256,9 @@ def map_config_to_obj(module):
|
||||||
'dest': dest,
|
'dest': dest,
|
||||||
'name': parse_name(line, dest),
|
'name': parse_name(line, dest),
|
||||||
'size': parse_size(line, dest),
|
'size': parse_size(line, dest),
|
||||||
'facility': parse_facility(line),
|
'facility': parse_facility(line, dest),
|
||||||
'level': parse_level(line, dest)
|
'level': parse_level(line, dest)
|
||||||
})
|
})
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,7 +331,7 @@ def main():
|
||||||
dest=dict(type='str', choices=['on', 'host', 'console', 'monitor', 'buffered']),
|
dest=dict(type='str', choices=['on', 'host', 'console', 'monitor', 'buffered']),
|
||||||
name=dict(type='str'),
|
name=dict(type='str'),
|
||||||
size=dict(type='int'),
|
size=dict(type='int'),
|
||||||
facility=dict(type='str', default='local7'),
|
facility=dict(type='str'),
|
||||||
level=dict(type='str', default='debugging'),
|
level=dict(type='str', default='debugging'),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue