From 4289354ce5109c1380b26767e508f24ee4957d85 Mon Sep 17 00:00:00 2001 From: Manuel Sousa Date: Sat, 6 Aug 2016 17:27:27 +0100 Subject: [PATCH] RabbitMQ-Binding - Allow empty routing key (#2674) Fixes: #1985 --- lib/ansible/modules/extras/messaging/rabbitmq_binding.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/messaging/rabbitmq_binding.py b/lib/ansible/modules/extras/messaging/rabbitmq_binding.py index ad7fa15146..2768095b9d 100644 --- a/lib/ansible/modules/extras/messaging/rabbitmq_binding.py +++ b/lib/ansible/modules/extras/messaging/rabbitmq_binding.py @@ -127,6 +127,11 @@ def main(): else: dest_type="e" + if module.params['routing_key'] == "": + props = "~" + else: + props = urllib.quote(module.params['routing_key'],'') + url = "http://%s:%s/api/bindings/%s/e/%s/%s/%s/%s" % ( module.params['login_host'], module.params['login_port'], @@ -134,7 +139,7 @@ def main(): urllib.quote(module.params['name'],''), dest_type, urllib.quote(module.params['destination'],''), - urllib.quote(module.params['routing_key'],'') + props ) # Check if exchange already exists