mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Removed tabs
This commit is contained in:
parent
7a234fc7cc
commit
7010a66638
1 changed files with 17 additions and 11 deletions
|
@ -840,24 +840,30 @@ def get_existing(module, prefix, warnings):
|
||||||
parents = 'vrf context {0}'.format(module.params['vrf'])
|
parents = 'vrf context {0}'.format(module.params['vrf'])
|
||||||
prefix_to_regex = fix_prefix_to_regex(prefix)
|
prefix_to_regex = fix_prefix_to_regex(prefix)
|
||||||
|
|
||||||
route_regex = '.*ip\sroute\s{0}\s(?P<next_hop>\S+)(\sname\s(?P<route_name>\S+))?(\stag\s(?P<tag>\d+))?(\s(?P<pref>\d+)).*'.format(prefix_to_regex)
|
route_regex = ('.*ip\sroute\s{0}\s(?P<next_hop>\S+)(\sname\s(?P<route_name>\S+))?'
|
||||||
|
'(\stag\s(?P<tag>\d+))?(\s(?P<pref>\d+)).*'.format(prefix_to_regex))
|
||||||
|
|
||||||
if module.params['vrf'] == 'default':
|
if module.params['vrf'] == 'default':
|
||||||
config = str(netcfg)
|
config = str(netcfg)
|
||||||
else:
|
else:
|
||||||
config = netcfg.get_section(parents)
|
config = netcfg.get_section(parents)
|
||||||
try:
|
|
||||||
match_route = re.match(route_regex, config, re.DOTALL)
|
|
||||||
group_route = match_route.groupdict()
|
|
||||||
|
|
||||||
for key in key_map:
|
if config:
|
||||||
if key not in group_route.keys():
|
try:
|
||||||
group_route['key'] = None
|
match_route = re.match(route_regex, config, re.DOTALL)
|
||||||
group_route['prefix'] = prefix
|
group_route = match_route.groupdict()
|
||||||
except (AttributeError, TypeError):
|
|
||||||
|
for key in key_map:
|
||||||
|
if key not in group_route.keys():
|
||||||
|
group_route[key] = ''
|
||||||
|
group_route['prefix'] = prefix
|
||||||
|
group_route['vrf'] = module.params['vrf']
|
||||||
|
except (AttributeError, TypeError):
|
||||||
|
group_route = {}
|
||||||
|
else:
|
||||||
group_route = {}
|
group_route = {}
|
||||||
if module.params['state'] == 'present':
|
msg = ("VRF {0} didn't exist.".format(module.params['vrf']))
|
||||||
msg = ("VRF {0} doesn't exist.".format(module.params['vrf']))
|
if msg not in warnings:
|
||||||
warnings.append(msg)
|
warnings.append(msg)
|
||||||
|
|
||||||
return group_route
|
return group_route
|
||||||
|
|
Loading…
Add table
Reference in a new issue