From 952d238d1522d002b91f68439e95ecf1473ab3bc Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 26 Mar 2024 09:33:35 +0100 Subject: [PATCH] Import openshift_client optionally Even if openshift_client is in the requirements of Tobiko, let's not fail if this lib is not available Change-Id: I4bb24aa7b620f1d73ceabda1e56e8e0608fb3a2e --- tobiko/podified/_openshift.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tobiko/podified/_openshift.py b/tobiko/podified/_openshift.py index e03b642e1..ee9c0cfb0 100644 --- a/tobiko/podified/_openshift.py +++ b/tobiko/podified/_openshift.py @@ -14,7 +14,6 @@ from __future__ import absolute_import import netaddr -import openshift_client as oc from oslo_log import log import tobiko @@ -40,6 +39,11 @@ EDPM_OTHER_GROUP = 'edpm-other' _IS_OC_CLIENT_AVAILABLE = None _IS_BM_CRD_AVAILABLE = None +try: + import openshift_client as oc +except ModuleNotFoundError: + _IS_OC_CLIENT_AVAILABLE = False + def _is_oc_client_available() -> bool: # pylint: disable=global-statement