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