mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Fixes to ios_logging (#41029)
* Logging size may not show up in config * This is much simpler * Avoid repetition in tests * Both options of buffered are optional
This commit is contained in:
parent
13c7d149bb
commit
92a95368fe
2 changed files with 16 additions and 43 deletions
|
@ -225,18 +225,12 @@ def parse_size(line, dest):
|
|||
size = None
|
||||
|
||||
if dest == 'buffered':
|
||||
match = re.search(r'logging buffered (\S+)', line, re.M)
|
||||
match = re.search(r'logging buffered(?: (\d+))?(?: [a-z]+)?', line, re.M)
|
||||
if match:
|
||||
try:
|
||||
int_size = int(match.group(1))
|
||||
except ValueError:
|
||||
int_size = None
|
||||
|
||||
if int_size:
|
||||
if isinstance(int_size, int):
|
||||
size = str(match.group(1))
|
||||
else:
|
||||
size = str(4096)
|
||||
if match.group(1) is not None:
|
||||
size = match.group(1)
|
||||
else:
|
||||
size = "4096"
|
||||
|
||||
return size
|
||||
|
||||
|
@ -261,15 +255,12 @@ def parse_level(line, dest):
|
|||
|
||||
else:
|
||||
if dest == 'buffered':
|
||||
match = re.search(r'logging buffered (?:\d+ )([a-z]+)', line, re.M)
|
||||
match = re.search(r'logging buffered(?: \d+)?(?: ([a-z]+))?', line, re.M)
|
||||
else:
|
||||
match = re.search(r'logging {0} (\S+)'.format(dest), line, re.M)
|
||||
|
||||
if match:
|
||||
if match.group(1) in level_group:
|
||||
level = match.group(1)
|
||||
else:
|
||||
level = 'debugging'
|
||||
if match and match.group(1) in level_group:
|
||||
level = match.group(1)
|
||||
else:
|
||||
level = 'debugging'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue