Do not catch all exceptions when deleting a nsgroup

This patch allows exception propagated to the caller when deleting
a nsgroup (similar to deleting a FW section and an ipset).
Thus callers can retry if the deletion failed.
This can avoid orphaned nsgroups still exist in the system.

Change-Id: I475a5c984aed7b6cae26951e64971ec463a43c5e
(cherry picked from commit fb67d1d2b7)
This commit is contained in:
Shih-Hao Li 2020-06-11 20:32:20 -07:00 committed by Salvatore Orlando
parent 6f2c89c618
commit 73708be026
1 changed files with 2 additions and 7 deletions

View File

@ -201,13 +201,8 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
'%s?populate_references=true' % self.get_path(nsgroup_id))
def delete(self, nsgroup_id):
try:
return self._delete_by_path_with_retry(
'%s?force=true' % self.get_path(nsgroup_id))
# FIXME(roeyc): Should only except NotFound error.
except Exception:
LOG.debug("NSGroup %s does not exists for delete request.",
nsgroup_id)
resource = '%s?force=true' % nsgroup_id
return self._delete_with_retry(resource)
def find_by_display_name(self, display_name):
found = []