Ensure correct exception is catched in case of not found exception

We are trying to catch a Neutron exception for a Kubernetes call.
This patch adds the correct handling in case a Kubernetes exception
is raised.

Change-Id: Ibebf62a3b49f40b148b35cc6ef8c90789daa46f5
This commit is contained in:
Maysa Macedo 2019-06-28 12:36:42 +00:00
parent c11b490f2e
commit 3e3c9b8dd5
1 changed files with 3 additions and 3 deletions

View File

@ -652,13 +652,13 @@ class NetworkPolicyDriver(base.NetworkPolicyDriver):
constants.K8S_API_CRD_NAMESPACES,
netpolicy_crd_namespace,
netpolicy_crd_name))
except exceptions.K8sResourceNotFound:
LOG.debug("KuryrNetPolicy CRD Object not found: %s",
netpolicy_crd_name)
except exceptions.K8sClientException:
LOG.exception("Kubernetes Client Exception deleting kuryrnetpolicy"
" CRD.")
raise
except n_exc.NotFound:
LOG.debug("KuryrNetPolicy CRD Object not found: %s",
netpolicy_crd_name)
def affected_pods(self, policy, selector=None):
if selector or selector == {}: