From ec78daa456c237e7f82a54c9dc7684d6e69e77a6 Mon Sep 17 00:00:00 2001 From: Frank Shearar Date: Tue, 9 Jul 2013 17:33:14 +0100 Subject: [PATCH 1/3] Let someone specify a path to a Rabbit that's not installed in the usual place. --- library/messaging/rabbitmq_plugin | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/messaging/rabbitmq_plugin b/library/messaging/rabbitmq_plugin index c9a90f31aa6..43ef05f465c 100644 --- a/library/messaging/rabbitmq_plugin +++ b/library/messaging/rabbitmq_plugin @@ -46,6 +46,11 @@ options: required: false default: enabled choices: [enabled, disabled] + path: + description: + - Specify a custom path to a Rabbit + required: false + default: null ''' EXAMPLES = ''' @@ -56,7 +61,11 @@ EXAMPLES = ''' class RabbitMqPlugins(object): def __init__(self, module): self.module = module - self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True) + + if module.params['path']: + self._rabbitmq_plugins = module.params['path'] + "/sbin/rabbitmq-plugins" + else: + self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True) def _exec(self, args, run_in_check_mode=False): if not self.module.check_mode or (self.module.check_mode and run_in_check_mode): @@ -78,7 +87,8 @@ def main(): arg_spec = dict( names=dict(required=True, aliases=['name']), new_only=dict(default='no', type='bool'), - state=dict(default='enabled', choices=['enabled', 'disabled']) + state=dict(default='enabled', choices=['enabled', 'disabled']), + path=dict(required=False, default=None) ) module = AnsibleModule( argument_spec=arg_spec, From 9ba4a42ff843cf1d1e5d1d46f8c0fc49397a0213 Mon Sep 17 00:00:00 2001 From: Frank Shearar Date: Tue, 9 Jul 2013 17:33:30 +0100 Subject: [PATCH 2/3] Minor typo --- library/messaging/rabbitmq_plugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/messaging/rabbitmq_plugin b/library/messaging/rabbitmq_plugin index 43ef05f465c..cc10b9e9658 100644 --- a/library/messaging/rabbitmq_plugin +++ b/library/messaging/rabbitmq_plugin @@ -42,7 +42,7 @@ options: choices: [ "yes", "no" ] state: description: - - Specify if pluginss are to be enabled or disabled + - Specify if plugins are to be enabled or disabled required: false default: enabled choices: [enabled, disabled] From 472c18c2b4645ec97251fea2be46ca3a71813001 Mon Sep 17 00:00:00 2001 From: Frank Shearar Date: Fri, 12 Jul 2013 10:13:53 +0100 Subject: [PATCH 3/3] 'prefix' avoids potentially making people confuse 'path' with $PATH. --- library/messaging/rabbitmq_plugin | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/messaging/rabbitmq_plugin b/library/messaging/rabbitmq_plugin index cc10b9e9658..e8dd46a412f 100644 --- a/library/messaging/rabbitmq_plugin +++ b/library/messaging/rabbitmq_plugin @@ -46,9 +46,9 @@ options: required: false default: enabled choices: [enabled, disabled] - path: + prefix: description: - - Specify a custom path to a Rabbit + - Specify a custom prefix to a Rabbit required: false default: null ''' @@ -62,8 +62,8 @@ class RabbitMqPlugins(object): def __init__(self, module): self.module = module - if module.params['path']: - self._rabbitmq_plugins = module.params['path'] + "/sbin/rabbitmq-plugins" + if module.params['prefix']: + self._rabbitmq_plugins = module.params['prefix'] + "/sbin/rabbitmq-plugins" else: self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True) @@ -88,7 +88,7 @@ def main(): names=dict(required=True, aliases=['name']), new_only=dict(default='no', type='bool'), state=dict(default='enabled', choices=['enabled', 'disabled']), - path=dict(required=False, default=None) + prefix=dict(required=False, default=None) ) module = AnsibleModule( argument_spec=arg_spec,