Fix for failing services on py3 with kombu driver

Change-Id: I20dc238cabe9991ed8e297c5cf9b062abc45f126
Closes-bug: 1661201
This commit is contained in:
Dawid Deja 2017-02-02 11:37:55 +01:00
parent c9ef100219
commit 1562d158a1
2 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@
import itertools import itertools
import random import random
import six
import oslo_messaging as messaging import oslo_messaging as messaging
@ -51,7 +52,7 @@ class KombuHosts(object):
self._hosts_cycle = itertools.cycle(self._hosts) self._hosts_cycle = itertools.cycle(self._hosts)
def get_host(self): def get_host(self):
return self._hosts_cycle.next() return six.next(self._hosts_cycle)
def get_hosts(self): def get_hosts(self):
return self._hosts return self._hosts

View File

@ -15,7 +15,7 @@
import itertools import itertools
from kombu.mixins import ConsumerMixin from kombu.mixins import ConsumerMixin
from six import moves import six
import threading import threading
from oslo_log import log as logging from oslo_log import log as logging
@ -39,7 +39,7 @@ class KombuRPCListener(ConsumerMixin):
self._max_sleep_time = 512 self._max_sleep_time = 512
def add_listener(self, correlation_id): def add_listener(self, correlation_id):
self._results[correlation_id] = moves.queue.Queue() self._results[correlation_id] = six.moves.queue.Queue()
def remove_listener(self, correlation_id): def remove_listener(self, correlation_id):
if correlation_id in self._results: if correlation_id in self._results:
@ -101,7 +101,7 @@ class KombuRPCListener(ConsumerMixin):
return self._results[correlation_id].get(block=True, timeout=timeout) return self._results[correlation_id].get(block=True, timeout=timeout)
def on_connection_error(self, exc, interval): def on_connection_error(self, exc, interval):
self.connection = self._connections.next() self.connection = six.next(self._connections)
LOG.debug("Broker connection failed: %s" % exc) LOG.debug("Broker connection failed: %s" % exc)
LOG.debug("Sleeping for %s seconds, then retrying connection" % LOG.debug("Sleeping for %s seconds, then retrying connection" %