1 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
2 Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins, :parent => Puppet::Provider::Rabbitmqctl) do
4 if Puppet::PUPPETVERSION.to_f < 3
5 if Facter.value(:osfamily) == 'RedHat'
6 commands :rabbitmqplugins => '/usr/lib/rabbitmq/bin/rabbitmq-plugins'
8 commands :rabbitmqplugins => 'rabbitmq-plugins'
11 if Facter.value(:osfamily) == 'RedHat'
12 has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do
13 environment :HOME => "/tmp"
16 has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
17 environment :HOME => "/tmp"
22 defaultfor :feature => :posix
25 self.run_with_retries {
26 rabbitmqplugins('list', '-E', '-m')
27 }.split(/\n/).map do |line|
31 raise Puppet::Error, "Cannot parse invalid plugins line: #{line}"
37 rabbitmqplugins('enable', resource[:name])
41 rabbitmqplugins('disable', resource[:name])
45 self.class.run_with_retries {
46 rabbitmqplugins('list', '-E', '-m')
47 }.split(/\n/).detect do |line|
48 line.match(/^#{resource[:name]}$/)