diff --git a/oslo/messaging/_drivers/impl_qpid.py b/oslo/messaging/_drivers/impl_qpid.py index 4df454c91..cac4d7b4a 100644 --- a/oslo/messaging/_drivers/impl_qpid.py +++ b/oslo/messaging/_drivers/impl_qpid.py @@ -441,6 +441,7 @@ class Connection(object): if not qpid_messaging: raise ImportError("Failed to import qpid.messaging") + self.connection = None self.session = None self.consumers = {} self.consumer_thread = None @@ -464,7 +465,6 @@ class Connection(object): self.brokers = params['qpid_hosts'] self.username = params['username'] self.password = params['password'] - self.connection_create(self.brokers[0]) self.reconnect() def connection_create(self, broker): @@ -495,7 +495,7 @@ class Connection(object): delay = 1 while True: # Close the session if necessary - if self.connection.opened(): + if self.connection is not None and self.connection.opened(): try: self.connection.close() except qpid_exceptions.ConnectionError: