mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
nxos_bgp: Fix idempotence for event-history (#27329)
* Fix idempotence for event-history * `event-history detail` defaults to `False`, the rest to `size_small`
This commit is contained in:
parent
29891bff19
commit
ed8a5af3dc
1 changed files with 11 additions and 9 deletions
|
@ -360,9 +360,9 @@ PARAM_TO_DEFAULT_KEYMAP = {
|
||||||
'suppress_fib_pending': True,
|
'suppress_fib_pending': True,
|
||||||
'fast_external_fallover': True,
|
'fast_external_fallover': True,
|
||||||
'enforce_first_as': True,
|
'enforce_first_as': True,
|
||||||
'event_history_periodic': True,
|
|
||||||
'event_history_cli': True,
|
'event_history_cli': True,
|
||||||
'event_history_events': True
|
'event_history_events': True,
|
||||||
|
'event_history_periodic': True,
|
||||||
}
|
}
|
||||||
PARAM_TO_COMMAND_KEYMAP = {
|
PARAM_TO_COMMAND_KEYMAP = {
|
||||||
'asn': 'router bgp',
|
'asn': 'router bgp',
|
||||||
|
@ -412,14 +412,16 @@ def get_value(arg, config):
|
||||||
|
|
||||||
if command.split()[0] == 'event-history':
|
if command.split()[0] == 'event-history':
|
||||||
command_re = re.compile(r'\s+{0}\s*'.format(command), re.M)
|
command_re = re.compile(r'\s+{0}\s*'.format(command), re.M)
|
||||||
|
has_size = re.search(r'^\s+{0} size\s(?P<value>.*)$'.format(command), config, re.M)
|
||||||
|
|
||||||
size_re = re.compile(r'(?:{0} size\s)(?P<value>.*)'.format(command), re.M)
|
if command == 'event-history detail':
|
||||||
value = False
|
value = False
|
||||||
|
else:
|
||||||
|
value = 'size_small'
|
||||||
|
|
||||||
if command_re.search(config):
|
if command_re.search(config):
|
||||||
search = size_re.search(config)
|
if has_size:
|
||||||
if search:
|
value = 'size_%s' % has_size.group('value')
|
||||||
value = search.group('value')
|
|
||||||
else:
|
else:
|
||||||
value = True
|
value = True
|
||||||
|
|
||||||
|
@ -431,10 +433,10 @@ def get_value(arg, config):
|
||||||
value = False
|
value = False
|
||||||
|
|
||||||
elif arg in BOOL_PARAMS:
|
elif arg in BOOL_PARAMS:
|
||||||
command_re = re.compile(r'\s+{0}\s*'.format(command), re.M)
|
has_command = re.search(r'^\s+{0}\s*$'.format(command), config, re.M)
|
||||||
value = False
|
value = False
|
||||||
|
|
||||||
if command_re.search(config):
|
if has_command:
|
||||||
value = True
|
value = True
|
||||||
else:
|
else:
|
||||||
command_val_re = re.compile(r'(?:{0}\s)(?P<value>.*)'.format(command), re.M)
|
command_val_re = re.compile(r'(?:{0}\s)(?P<value>.*)'.format(command), re.M)
|
||||||
|
|
Loading…
Reference in a new issue