ios_logging: fix idempotence errors (#53109)

* ios_logging: fix the error checking the existence of "host" destinations (IOS 12)

In the "have" list, records of type "host" do not contain the key "size",
although in the list "want" it is always there. Because of this, the module
assumes that the "host" type destinations is not configured and does it again.
This does not change the configuration on the device, but is redundant and
the status of the task will always be "changed". This patch fixes it.

* ios_logging: fixes #53227

* ios_logging: minor changes in string matching
This commit is contained in:
hexdump0x0200 2019-03-07 19:10:03 +07:00 committed by Nilashish Chakraborty
commit 4d407d1781
4 changed files with 84 additions and 1 deletions

View file

@ -274,7 +274,7 @@ def map_config_to_obj(module):
data = get_config(module, flags=['| include logging'])
for line in data.split('\n'):
match = re.search(r'logging (\S+)', line, re.M)
match = re.search(r'^logging (\S+)', line, re.M)
if match:
if match.group(1) in dest_group:
dest = match.group(1)
@ -291,6 +291,7 @@ def map_config_to_obj(module):
obj.append({
'dest': dest,
'name': match.group(1),
'size': parse_size(line, dest),
'facility': parse_facility(line, dest),
'level': parse_level(line, dest)
})
@ -301,6 +302,7 @@ def map_config_to_obj(module):
obj.append({
'dest': dest,
'name': match.group(1),
'size': parse_size(line, dest),
'facility': parse_facility(line, dest),
'level': parse_level(line, dest)
})