From e17699d3d1b50955455d46d5c79b4a9078aa054b Mon Sep 17 00:00:00 2001 From: Andre Mauricio Zelak Date: Wed, 15 Mar 2023 15:02:16 -0300 Subject: [PATCH] Use new get_rpc_client API from oslo.messaging Use the new get_rpc_client API to handle the RCPClient instantiation. This new API was added into oslo.messaging here [1]. [1] https://review.opendev.org/c/openstack/oslo.messaging/+/862419 Closes-bug: 2011620 Signed-off-by: Andre Mauricio Zelak Change-Id: I2322d0bb49b342f8eec49f599257f9dac83b3d8a --- .../locationservice/locationservicesdk/client/base.py | 4 ++-- .../locationservicesdk/common/helpers/rpc_helper.py | 2 +- .../notificationclientsdk/client/base.py | 4 ++-- .../notificationclientsdk/common/helpers/rpc_helper.py | 2 +- .../ptptrackingfunction/trackingfunctionsdk/client/base.py | 6 +++--- .../trackingfunctionsdk/common/helpers/rpc_helper.py | 4 ++-- .../ptptrackingfunction/trackingfunctionsdk/client/base.py | 4 ++-- .../trackingfunctionsdk/common/helpers/rpc_helper.py | 2 +- .../resources/scripts/init/locationservice_start.sh | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/locationservice-base/docker/locationservice/locationservicesdk/client/base.py b/locationservice-base/docker/locationservice/locationservicesdk/client/base.py index 5b19eeb..355a797 100644 --- a/locationservice-base/docker/locationservice/locationservicesdk/client/base.py +++ b/locationservice-base/docker/locationservice/locationservicesdk/client/base.py @@ -102,12 +102,12 @@ class BrokerClientBase(object): target = oslo_messaging.Target( topic=topic, server=server, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = 2, retry = 0) + queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = 2, retry = 0) return queryclient.call({}, api_name, **api_kwargs) def cast(self, topic, api_name, **api_kwargs): target = oslo_messaging.Target( topic=topic, fanout=True, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target) + queryclient = oslo_messaging.get_rpc_client(self.transport, target) queryclient.cast({}, api_name, **api_kwargs) diff --git a/locationservice-base/docker/locationservice/locationservicesdk/common/helpers/rpc_helper.py b/locationservice-base/docker/locationservice/locationservicesdk/common/helpers/rpc_helper.py index 9e2daee..54b4d5e 100644 --- a/locationservice-base/docker/locationservice/locationservicesdk/common/helpers/rpc_helper.py +++ b/locationservice-base/docker/locationservice/locationservicesdk/common/helpers/rpc_helper.py @@ -19,7 +19,7 @@ def setup_client(rpc_endpoint_info, topic, server): version=rpc_endpoint_info.Version, server=server, namespace=rpc_endpoint_info.Namespace) - client = oslo_messaging.RPCClient(transport, target) + client = oslo_messaging.get_rpc_client(transport, target) return client def get_transport(rpc_endpoint_info): diff --git a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/base.py b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/base.py index 73a16c5..76b59ed 100644 --- a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/base.py +++ b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/client/base.py @@ -162,12 +162,12 @@ class BrokerClientBase(object): namespace=self.broker_endpoint.Namespace) # note: the call might stuck here on 'Connection failed' and retry forever # due to the tcp connection is unreachable: 'AMQP server on : is unreachable: timed out' - queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry) + queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry) return queryclient.call({}, api_name, **api_kwargs) def cast(self, topic, api_name, timeout=None, retry=None, **api_kwargs): target = oslo_messaging.Target( topic=topic, fanout=True, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry) + queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry) queryclient.cast({}, api_name, **api_kwargs) diff --git a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/common/helpers/rpc_helper.py b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/common/helpers/rpc_helper.py index 8d639df..e894a52 100644 --- a/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/common/helpers/rpc_helper.py +++ b/notificationclient-base/docker/notificationclient-sidecar/notificationclientsdk/common/helpers/rpc_helper.py @@ -19,7 +19,7 @@ def setup_client(rpc_endpoint_info, topic, server): version=rpc_endpoint_info.Version, server=server, namespace=rpc_endpoint_info.Namespace) - client = oslo_messaging.RPCClient(transport, target) + client = oslo_messaging.get_rpc_client(transport, target) return client def get_transport(rpc_endpoint_info): diff --git a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py index 7d13e46..a4b0f29 100644 --- a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py +++ b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2023 Wind River Systems, Inc. +# Copyright (c) 2021-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -102,12 +102,12 @@ class BrokerClientBase(object): target = oslo_messaging.Target( topic=topic, server=server, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry) + queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry) return queryclient.call({}, api_name, **api_kwargs) def cast(self, topic, api_name, **api_kwargs): target = oslo_messaging.Target( topic=topic, fanout=True, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target) + queryclient = oslo_messaging.get_rpc_client(self.transport, target) queryclient.cast({}, api_name, **api_kwargs) diff --git a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py index 0a85a5c..80214d1 100644 --- a/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py +++ b/notificationservice-base-v2/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py @@ -1,6 +1,6 @@ #coding=utf-8 # -# Copyright (c) 2021-2023 Wind River Systems, Inc. +# Copyright (c) 2021-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -16,7 +16,7 @@ def setup_client(rpc_endpoint_info, topic, server): version=rpc_endpoint_info.Version, server=server, namespace=rpc_endpoint_info.Namespace) - client = oslo_messaging.RPCClient(transport, target) + client = oslo_messaging.get_rpc_client(transport, target) return client def get_transport(rpc_endpoint_info): diff --git a/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py b/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py index 34cc8c7..58e9b14 100644 --- a/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py +++ b/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/client/base.py @@ -102,12 +102,12 @@ class BrokerClientBase(object): target = oslo_messaging.Target( topic=topic, server=server, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target, timeout = timeout, retry = retry) + queryclient = oslo_messaging.get_rpc_client(self.transport, target, timeout = timeout, retry = retry) return queryclient.call({}, api_name, **api_kwargs) def cast(self, topic, api_name, **api_kwargs): target = oslo_messaging.Target( topic=topic, fanout=True, version=self.broker_endpoint.Version, namespace=self.broker_endpoint.Namespace) - queryclient = oslo_messaging.RPCClient(self.transport, target) + queryclient = oslo_messaging.get_rpc_client(self.transport, target) queryclient.cast({}, api_name, **api_kwargs) diff --git a/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py b/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py index cd97a3d..8b52e28 100644 --- a/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py +++ b/notificationservice-base/docker/ptptrackingfunction/trackingfunctionsdk/common/helpers/rpc_helper.py @@ -16,7 +16,7 @@ def setup_client(rpc_endpoint_info, topic, server): version=rpc_endpoint_info.Version, server=server, namespace=rpc_endpoint_info.Namespace) - client = oslo_messaging.RPCClient(transport, target) + client = oslo_messaging.get_rpc_client(transport, target) return client def get_transport(rpc_endpoint_info): diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh index df7dc0f..78efe94 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh @@ -107,7 +107,7 @@ target = oslo_messaging.Target( fanout=True, version='1.0', namespace='notification') -client = oslo_messaging.RPCClient(transport, target) +client = oslo_messaging.get_rpc_client(transport, target) LocationInfo = { 'NodeName': THIS_NODE_NAME, 'PodIP': THIS_POD_IP,