From 9ba1f6a57ecfc09f9450f4e253cca2753df1a4ab Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Tue, 29 Aug 2017 19:56:37 +0300 Subject: [PATCH] NSX|V3 Admin utils expect different notFound error There are 2 types of "resource not found" errors returned from the nsx backed. Status 404 with error code 202, and status 404 with error code 600. The admin utils should excpect both. Change-Id: I1091dfe4a13610f223229b0b9f63d65956af7cbe --- vmware_nsx/shell/admin/plugins/nsxv3/resources/networks.py | 4 ++-- vmware_nsx/shell/admin/plugins/nsxv3/resources/routers.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/networks.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/networks.py index 42652d303f..84c228eb52 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/networks.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/networks.py @@ -107,7 +107,7 @@ def delete_backend_network(resource, event, trigger, **kwargs): # check if the network exists try: nsxlib.logical_switch.get(nsx_id, silent=True) - except nsx_exc.BackendResourceNotFound: + except nsx_exc.ResourceNotFound: # prevent logger from logging this exception sys.exc_clear() LOG.warning("Backend network %s was not found.", nsx_id) @@ -125,7 +125,7 @@ def delete_backend_network(resource, event, trigger, **kwargs): # through errors try: nsxlib.logical_switch.get(nsx_id, silent=True) - except nsx_exc.BackendResourceNotFound: + except nsx_exc.ResourceNotFound: # prevent logger from logging this exception sys.exc_clear() LOG.info("Backend network %s was deleted.", nsx_id) diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/routers.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/routers.py index 4115dff4c6..f1b2b80859 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/routers.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/routers.py @@ -141,7 +141,7 @@ def delete_backend_router(resource, event, trigger, **kwargs): # check if the router exists try: nsxlib.logical_router.get(nsx_id, silent=True) - except nsx_exc.BackendResourceNotFound: + except nsx_exc.ResourceNotFound: # prevent logger from logging this exception sys.exc_clear() LOG.warning("Backend router %s was not found.", nsx_id) @@ -163,7 +163,7 @@ def delete_backend_router(resource, event, trigger, **kwargs): # throws errors try: nsxlib.logical_router.get(nsx_id, silent=True) - except nsx_exc.BackendResourceNotFound: + except nsx_exc.ResourceNotFound: # prevent logger from logging this exception sys.exc_clear() LOG.info("Backend router %s was deleted.", nsx_id)