diff options
author | Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com> | 2018-07-18 16:56:23 +0100 |
---|---|---|
committer | Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com> | 2018-07-24 09:17:01 +0100 |
commit | 7bea8397ca0815609b62b0799f9159492399fe13 (patch) | |
tree | e5eff19c1adf4a40c6c3f9dbf5664c3c99f4ed28 /yardstick/common | |
parent | abb0dd41a45dd6cbc0f1c0f2831aa2e0b4647566 (diff) |
kubernetes_utils: avoid 404 error code in delete_network()
JIRA: YARDSTICK-1316
Change-Id: I792c873b42aba80be62ff7a93f6d02ea89e42356
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r-- | yardstick/common/kubernetes_utils.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/yardstick/common/kubernetes_utils.py b/yardstick/common/kubernetes_utils.py index f5b0443ea..c90f73e43 100644 --- a/yardstick/common/kubernetes_utils.py +++ b/yardstick/common/kubernetes_utils.py @@ -266,7 +266,8 @@ def create_network(scope, group, version, plural, body, namespace='default'): action='create', resource='Custom Object: Network') -def delete_network(scope, group, version, plural, name, namespace='default'): +def delete_network(scope, group, version, plural, name, namespace='default', skip_codes=None): + skip_codes = [] if not skip_codes else skip_codes api = get_custom_objects_api() try: if scope == consts.SCOPE_CLUSTER: @@ -274,9 +275,12 @@ def delete_network(scope, group, version, plural, name, namespace='default'): else: api.delete_namespaced_custom_object( group, version, namespace, plural, name, {}) - except ApiException: - raise exceptions.KubernetesApiException( - action='delete', resource='Custom Object: Network') + except ApiException as e: + if e.status in skip_codes: + LOG.info(e.reason) + else: + raise exceptions.KubernetesApiException( + action='delete', resource='Custom Object: Network') def get_pod_list(namespace='default'): # pragma: no cover |