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:
GomathiselviS 2020-01-09 14:43:59 -05:00 committed by GitHub
parent f70f426604
commit a3d67edfca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -237,11 +237,13 @@ def map_obj_to_commands(updates, module):
admin_state = w['admin_state']
vni = w['vni']
interfaces = w.get('interfaces') or []
state = w['state']
if purge:
state = "absent"
else:
state = w['state']
del w['state']
obj_in_have = search_obj_in_list(name, have)
if state == 'absent' and obj_in_have:
commands.append('no vrf context {0}'.format(name))
@ -344,12 +346,14 @@ def map_obj_to_commands(updates, module):
def validate_vrf(name, module):
if name == 'default':
module.fail_json(msg='cannot use default as name of a VRF')
elif len(name) > 32:
module.fail_json(msg='VRF name exceeded max length of 32', name=name)
else:
return name
if name:
name = name.strip()
if name == 'default':
module.fail_json(msg='cannot use default as name of a VRF')
elif len(name) > 32:
module.fail_json(msg='VRF name exceeded max length of 32', name=name)
else:
return name
def map_params_to_obj(module):