From 6ffad90d16764ec0686140d7449e6057337f8445 Mon Sep 17 00:00:00 2001 From: Matheus Machado Guilhermino Date: Wed, 16 Feb 2022 01:26:04 -0300 Subject: [PATCH] Handle PEP479 issues on ha Similar to how PEP479 was handled on config[1]. Instances of "raise StopIteration" were changed to a plain 'return' statement in order to avoid breaking the existing logic. CentOS 7 tests: PASS: Build & install PASS: Successful Bootstrap Debian Bullseye tests: PASS: Build & install PASS: Successful Bootstrap [1] https://review.opendev.org/c/starlingx/config/+/825447 Story: 2009101 Task: 44513 Signed-off-by: Matheus Machado Guilhermino Change-Id: Ibe4717e64fcee159c1bc4a17acf623adbfae3908 --- .../sm-api/sm_api/openstack/common/rpc/amqp.py | 8 ++++---- .../sm-api/sm_api/openstack/common/rpc/impl_kombu.py | 2 +- .../sm-api/sm_api/openstack/common/rpc/impl_qpid.py | 2 +- service-mgmt-client/sm-client/sm_client/common/http.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py index 3f4467a3..c6fac616 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/amqp.py @@ -500,7 +500,7 @@ class MulticallProxyWaiter(object): def __iter__(self): """Return a result until we get a reply with an 'ending" flag""" if self._done: - raise StopIteration + return while True: try: data = self._dataqueue.get(timeout=self._timeout) @@ -513,7 +513,7 @@ class MulticallProxyWaiter(object): self.done() if self._got_ending: self.done() - raise StopIteration + return if isinstance(result, Exception): self.done() raise result @@ -556,7 +556,7 @@ class MulticallWaiter(object): def __iter__(self): """Return a result until we get a 'None' response from consumer""" if self._done: - raise StopIteration + return while True: try: next(self._iterator) @@ -565,7 +565,7 @@ class MulticallWaiter(object): self.done() if self._got_ending: self.done() - raise StopIteration + return result = self._result if isinstance(result, Exception): self.done() diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py index f8bc4217..4b08306b 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_kombu.py @@ -665,7 +665,7 @@ class Connection(object): for iteration in itertools.count(0): if limit and iteration >= limit: - raise StopIteration + return yield self.ensure(_error_callback, _consume) def cancel_consumer_thread(self): diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py index 61df807a..de99333b 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/impl_qpid.py @@ -440,7 +440,7 @@ class Connection(object): for iteration in itertools.count(0): if limit and iteration >= limit: - raise StopIteration + return yield self.ensure(_error_callback, _consume) def cancel_consumer_thread(self): diff --git a/service-mgmt-client/sm-client/sm_client/common/http.py b/service-mgmt-client/sm-client/sm_client/common/http.py index 93e0c2c8..a565c191 100644 --- a/service-mgmt-client/sm-client/sm_client/common/http.py +++ b/service-mgmt-client/sm-client/sm_client/common/http.py @@ -294,7 +294,7 @@ class ResponseBodyIterator(object): if chunk: return chunk else: - raise StopIteration() + return # In Python 3, __next__() has replaced next(). __next__ = next