Commit dd657362 authored by Francesco Pace's avatar Francesco Pace
Browse files

Add port to plugin channel

Signed-off-by: default avatarFrancesco Pace <>
parent 5005f9ab
......@@ -198,7 +198,7 @@ def _storage_plugin_check(data):
def _channel_check(data):
required_keys = ['protocol', 'host', 'username', 'password']
required_keys = ['protocol', 'host', 'port', 'username', 'password']
for k in required_keys:
if k not in data:
raise InvalidApplicationDescription(msg="Missing required key: %s" % k)
......@@ -20,16 +20,18 @@ log = logging.getLogger(__name__)
class RabbitMQ:
def __init__(self, username, password, host):
def __init__(self, username, password, host, port=None):
self.username = username
self.password = password = host
self.port = port = None
def open_connection(self):
log.debug("Opening connection to RabbitMQ: {}".format(
credentials = pika.PlainCredentials(self.username, self.password)
connection = pika.BlockingConnection(pika.ConnectionParameters(, credentials=credentials))
connection = pika.BlockingConnection(
pika.ConnectionParameters(, port=self.port, credentials=credentials)) =
def send_message(self, exchange, queue, message):
......@@ -27,7 +27,7 @@ class Crystal:
message = "{}:{}".format(tenant, policy)
if['protocol'] == 'rabbitmq':
log.debug("Transmitting policy to Crystal via RabbitMQ")
rmq = RabbitMQ(['username'],['password'],['host'])
rmq = RabbitMQ(['username'],['password'],['host'],['port'])
rmq.send_message(['exchange'],['queue'], message)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment