From 112f4262f1949f1d544357833af8e4b7d1a844b0 Mon Sep 17 00:00:00 2001 From: Manuel Sousa Date: Thu, 14 May 2015 15:26:20 +0100 Subject: [PATCH] Make compatible with python 2.4 Removed one line if else --- messaging/rabbitmq_binding.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/messaging/rabbitmq_binding.py b/messaging/rabbitmq_binding.py index 2d34f0c71bf..b8adb94ec6a 100644 --- a/messaging/rabbitmq_binding.py +++ b/messaging/rabbitmq_binding.py @@ -121,12 +121,17 @@ def main(): supports_check_mode = True ) + if module.params['destinationType'] == "queue": + destType="q" + else: + destType="e" + url = "http://%s:%s/api/bindings/%s/e/%s/%s/%s/%s" % ( module.params['login_host'], module.params['login_port'], urllib.quote(module.params['vhost'],''), module.params['name'], - "q" if module.params['destinationType'] == "queue" else "e", + destType, module.params['destination'], urllib.quote(module.params['routingKey'],'') ) @@ -146,7 +151,10 @@ def main(): details = r.text ) - changeRequired = not bindingExists if module.params['state']=='present' else bindingExists + if module.params['state']=='present': + changeRequired = not bindingExists + else: + changeRequired = bindingExists # Exit if check_mode if module.check_mode: @@ -165,7 +173,7 @@ def main(): module.params['login_port'], urllib.quote(module.params['vhost'],''), module.params['name'], - "q" if module.params['destinationType'] == "queue" else "e", + destType, module.params['destination'] )