Skip to content

Commit 0f454b3

Browse files
Merge pull request #526 from RedHatQE/JacobCallahan-depadjust
Update websocket_client dependency version
2 parents f53705f + cef774a commit 0f454b3

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies = [
4646
"azure-mgmt-network",
4747
"azure-mgmt-resource",
4848
"azure-mgmt-storage",
49+
"azure-mgmt-subscription",
4950
"azure-storage-blob",
5051
"boto",
5152
"boto3",
@@ -60,7 +61,7 @@ dependencies = [
6061
"lxml",
6162
"miq-version",
6263
"msrestazure",
63-
"openshift==0.3.4",
64+
"openshift>=0.13.0",
6465
"ovirt-engine-sdk-python~=4.3",
6566
"packaging",
6667
"podman>5.0.0",

wrapanapi/systems/container/rhopenshift.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@
1010
from kubernetes import client as kubeclient
1111
from kubernetes.client.rest import ApiException
1212
from miq_version import TemplateName, Version
13-
from openshift import client as ociclient
1413
from wait_for import TimedOutError, wait_for
1514

15+
# Try to import openshift client module
16+
# In openshift>=0.13, the static client module was removed in favor of the dynamic client
17+
# For backward compatibility, we attempt the import but allow it to fail gracefully
18+
try:
19+
from openshift import client as ociclient
20+
21+
_OPENSHIFT_CLIENT_AVAILABLE = True
22+
except (ImportError, AttributeError):
23+
# openshift.client module doesn't exist in openshift>=0.13
24+
# The OpenShift functionality will not work until code is migrated to dynamic client
25+
ociclient = None
26+
_OPENSHIFT_CLIENT_AVAILABLE = False
27+
1628
from wrapanapi.systems.base import System
1729

1830
# this service allows to access db outside of openshift
@@ -196,6 +208,14 @@ def _identifying_attrs(self):
196208
return {"hostname": self.hostname, "port": self.port}
197209

198210
def _connect(self):
211+
if not _OPENSHIFT_CLIENT_AVAILABLE or ociclient is None:
212+
raise ImportError(
213+
"The openshift.client module is not available. "
214+
"OpenShift requires openshift<=0.13 which is incompatible with Python 3.9+, "
215+
"or the code needs to be migrated to use the openshift.dynamic client API. "
216+
"See https://github.com/openshift/openshift-restclient-python for guidance."
217+
)
218+
199219
url = "{proto}://{host}:{port}".format(
200220
proto=self.protocol, host=self.hostname, port=self.port
201221
)

wrapanapi/systems/msazure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from azure.mgmt.iothub import IotHubClient
1515
from azure.mgmt.network import NetworkManagementClient
1616
from azure.mgmt.network.models import NetworkSecurityGroup, SecurityRule
17-
from azure.mgmt.resource import SubscriptionClient
1817
from azure.mgmt.resource.resources import ResourceManagementClient
19-
from azure.mgmt.resource.subscriptions.models import SubscriptionState
2018
from azure.mgmt.storage import StorageManagementClient
19+
from azure.mgmt.subscription import SubscriptionClient
20+
from azure.mgmt.subscription.models import SubscriptionState
2121
from azure.storage.blob import BlobServiceClient
2222
from dateutil import parser
2323
from msrestazure.azure_exceptions import CloudError

0 commit comments

Comments
 (0)