1
0
Fork 0
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:
Nathaniel Case 2017-08-10 08:55:43 -04:00 committed by GitHub
parent 29891bff19
commit ed8a5af3dc

View file

@ -360,9 +360,9 @@ PARAM_TO_DEFAULT_KEYMAP = {
'suppress_fib_pending': True,
'fast_external_fallover': True,
'enforce_first_as': True,
'event_history_periodic': True,
'event_history_cli': True,
'event_history_events': True
'event_history_events': True,
'event_history_periodic': True,
}
PARAM_TO_COMMAND_KEYMAP = {
'asn': 'router bgp',
@ -412,14 +412,16 @@ def get_value(arg, config):
if command.split()[0] == 'event-history':
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
else:
value = 'size_small'
if command_re.search(config):
search = size_re.search(config)
if search:
value = search.group('value')
if has_size:
value = 'size_%s' % has_size.group('value')
else:
value = True
@ -431,10 +433,10 @@ def get_value(arg, config):
value = False
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
if command_re.search(config):
if has_command:
value = True
else:
command_val_re = re.compile(r'(?:{0}\s)(?P<value>.*)'.format(command), re.M)