Fix to nxos_vrf purge breaks with empty aggregate (#66004)
* resolving conflicts * fixed issue with purge and state var. fixed space issue with vrf name * lint issues
This commit is contained in:
parent
f70f426604
commit
a3d67edfca
1 changed files with 12 additions and 8 deletions
|
@ -237,11 +237,13 @@ def map_obj_to_commands(updates, module):
|
||||||
admin_state = w['admin_state']
|
admin_state = w['admin_state']
|
||||||
vni = w['vni']
|
vni = w['vni']
|
||||||
interfaces = w.get('interfaces') or []
|
interfaces = w.get('interfaces') or []
|
||||||
state = w['state']
|
if purge:
|
||||||
|
state = "absent"
|
||||||
|
else:
|
||||||
|
state = w['state']
|
||||||
del w['state']
|
del w['state']
|
||||||
|
|
||||||
obj_in_have = search_obj_in_list(name, have)
|
obj_in_have = search_obj_in_list(name, have)
|
||||||
|
|
||||||
if state == 'absent' and obj_in_have:
|
if state == 'absent' and obj_in_have:
|
||||||
commands.append('no vrf context {0}'.format(name))
|
commands.append('no vrf context {0}'.format(name))
|
||||||
|
|
||||||
|
@ -344,12 +346,14 @@ def map_obj_to_commands(updates, module):
|
||||||
|
|
||||||
|
|
||||||
def validate_vrf(name, module):
|
def validate_vrf(name, module):
|
||||||
if name == 'default':
|
if name:
|
||||||
module.fail_json(msg='cannot use default as name of a VRF')
|
name = name.strip()
|
||||||
elif len(name) > 32:
|
if name == 'default':
|
||||||
module.fail_json(msg='VRF name exceeded max length of 32', name=name)
|
module.fail_json(msg='cannot use default as name of a VRF')
|
||||||
else:
|
elif len(name) > 32:
|
||||||
return name
|
module.fail_json(msg='VRF name exceeded max length of 32', name=name)
|
||||||
|
else:
|
||||||
|
return name
|
||||||
|
|
||||||
|
|
||||||
def map_params_to_obj(module):
|
def map_params_to_obj(module):
|
||||||
|
|
Loading…
Reference in a new issue