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
This commit is contained in:
Slawek Kaplonski 2024-03-26 09:33:35 +01:00
parent 46a1868f6f
commit 952d238d15
1 changed files with 5 additions and 1 deletions

View File

@ -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