From 73708be026e1e81c27e534f51b6cfd2601948882 Mon Sep 17 00:00:00 2001 From: Shih-Hao Li Date: Thu, 11 Jun 2020 20:32:20 -0700 Subject: [PATCH] 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 fb67d1d2b7809fd89904b442e620899a2d939bcf) --- vmware_nsxlib/v3/security.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/vmware_nsxlib/v3/security.py b/vmware_nsxlib/v3/security.py index 6b612df2..47bb3b14 100644 --- a/vmware_nsxlib/v3/security.py +++ b/vmware_nsxlib/v3/security.py @@ -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 = []