From 5c03696693cdee250e3bc78166bdb41846c685f3 Mon Sep 17 00:00:00 2001 From: Philip Carinhas Date: Sat, 6 Dec 2014 12:31:08 -0600 Subject: [PATCH 1/2] Fix rabbitmq_plugin.py: broken prefix path --- messaging/rabbitmq_plugin.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/messaging/rabbitmq_plugin.py b/messaging/rabbitmq_plugin.py index 53c38f978d5..194af2f6dc9 100644 --- a/messaging/rabbitmq_plugin.py +++ b/messaging/rabbitmq_plugin.py @@ -59,12 +59,23 @@ EXAMPLES = ''' - rabbitmq_plugin: names=rabbitmq_management state=enabled ''' +import os + class RabbitMqPlugins(object): def __init__(self, module): self.module = module if module.params['prefix']: - self._rabbitmq_plugins = module.params['prefix'] + "/sbin/rabbitmq-plugins" + if os.path.isdir(os.path.join(module.params['prefix'], 'bin')): + bin_path = os.path.join(module.params['prefix'], 'bin') + elif os.path.isdir(os.path.join(module.params['prefix'], 'sbin')): + bin_path = os.path.join(module.params['prefix'], 'sbin') + else: + # No such path exists. + raise Exception("No binary folder in RabbitMQ prefix") + + self._rabbitmq_plugins = bin_path + "/rabbitmq-plugins" + else: self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True) From 530323bf63ad0331229631f7a254480d1a2abc92 Mon Sep 17 00:00:00 2001 From: Philip Carinhas Date: Sun, 7 Dec 2014 10:01:49 -0600 Subject: [PATCH 2/2] Improve error message --- messaging/rabbitmq_plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/messaging/rabbitmq_plugin.py b/messaging/rabbitmq_plugin.py index 194af2f6dc9..8c6ca1381d8 100644 --- a/messaging/rabbitmq_plugin.py +++ b/messaging/rabbitmq_plugin.py @@ -72,7 +72,8 @@ class RabbitMqPlugins(object): bin_path = os.path.join(module.params['prefix'], 'sbin') else: # No such path exists. - raise Exception("No binary folder in RabbitMQ prefix") + raise Exception("No binary folder in prefix %s" % + module.params['prefix']) self._rabbitmq_plugins = bin_path + "/rabbitmq-plugins"