Use proper ApiException from kubernetes client

Seems like folks developing Python kubernetes client had move the
ApiException around. So the backward-compatible way of using it is
kubernetes.client.rest.ApiException and trying to use it by
kubernetes.client.excetpions.ApiException will not work in older library
versions. As this client is supposed to still be compatible with
stable/victoria and kubernetes==11.0.0, this commit changes the
exception module to `rest` where needed.

Change-Id: If056529d49a053970891f89d12007174f544a551
This commit is contained in:
Michał Dulko 2022-06-14 14:56:12 +02:00
parent 61bfb58898
commit 28da7f63d3
1 changed files with 2 additions and 2 deletions

View File

@ -218,7 +218,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
name=pod_name,
body=body,
namespace=namespace)
except kubernetes.client.exceptions.ApiException as e:
except kubernetes.client.rest.ApiException as e:
if e.status != 404:
raise
LOG.debug("Pod %s was not found.", pod_name)
@ -229,7 +229,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
pod_name,
namespace)
time.sleep(5)
except kubernetes.client.exceptions.ApiException as e:
except kubernetes.client.rest.ApiException as e:
if e.status != 404:
LOG.warning("An exception occured: %s", e)
break