NSXAdmin: Ignore response codes when issueing a delete fw section req

The manager returns 400 response code for request that tries to remove a
non-existent firewall section, untill this is sort out (by returning 404
instead) we wrapping the call with a try..except clause and ignore the
response code.

Change-Id: I03c1ccd53f43cfd0b2c5513b02837c155a2813b4
This commit is contained in:
Roey Chen 2016-11-09 06:32:02 -08:00
parent 97916ebf85
commit f1c87cde28

View File

@ -206,7 +206,14 @@ def fix_security_groups(resource, event, trigger, **kwargs):
for sg_id, sg in inconsistent_secgroups.items():
secgroup = plugin.get_security_group(context_, sg_id)
nsxlib.firewall_section.delete(sg['section-id'])
try:
# FIXME(roeyc): try..except clause should be removed once the api
# will return 404 response code instead 400 for trying to delete a
# non-existing firewall section.
nsxlib.firewall_section.delete(sg['section-id'])
except Exception:
pass
nsxlib.ns_group.delete(sg['nsx-securitygroup-id'])
neutron_sg.delete_security_group_section_mapping(sg_id)
neutron_sg.delete_security_group_backend_mapping(sg_id)