From cabe1bbe887021e14f03b7afdc1e70a3450e95a5 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Wed, 17 Apr 2013 12:36:27 +0100 Subject: [PATCH] librabbitmq itself now raises if SSL enabled --- kombu/connection.py | 5 ----- kombu/exceptions.py | 2 -- kombu/transport/librabbitmq.py | 6 ++++++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/kombu/connection.py b/kombu/connection.py index df284762..9a6146dc 100644 --- a/kombu/connection.py +++ b/kombu/connection.py @@ -110,8 +110,6 @@ class Connection(object): >>> conn.release() """ - SSLNotSupported = exceptions.SSLNotSupported - port = None virtual_host = '/' connect_timeout = 5 @@ -235,9 +233,6 @@ class Connection(object): self.transport_cls = transport self.heartbeat = heartbeat and float(heartbeat) - if ssl and transport == 'librabbitmq': - raise self.SSLNotSupported(transport) - def _debug(self, msg, *args, **kwargs): fmt = '[Kombu connection:0x%(id)x] %(msg)s' if self._logger: # pragma: no cover diff --git a/kombu/exceptions.py b/kombu/exceptions.py index a81db17c..32261506 100644 --- a/kombu/exceptions.py +++ b/kombu/exceptions.py @@ -45,8 +45,6 @@ class ChannelLimitExceeded(LimitExceeded): """Maximum number of simultaneous channels exceeded.""" pass -class SSLNotSupported(KombuError): - pass class StdConnectionError(KombuError): pass diff --git a/kombu/transport/librabbitmq.py b/kombu/transport/librabbitmq.py index acfa33e7..818acc77 100644 --- a/kombu/transport/librabbitmq.py +++ b/kombu/transport/librabbitmq.py @@ -28,6 +28,10 @@ from . import base DEFAULT_PORT = 5672 +NO_SSL_ERROR = """\ +ssl not supported by librabbitmq, please use pyamqp:// or stunnel\ +""" + class Message(base.Message): @@ -98,6 +102,8 @@ class Transport(base.Transport): for name, default_value in self.default_connection_params.items(): if not getattr(conninfo, name, None): setattr(conninfo, name, default_value) + if conninfo.ssl: + raise NotImplementedError(NO_SSL_ERROR) conn = self.Connection(host=conninfo.host, userid=conninfo.userid, password=conninfo.password,