From d262edbf4ed3bd11388f2d1d33346099c1e488d7 Mon Sep 17 00:00:00 2001 From: Mike Dorman Date: Fri, 14 Nov 2014 12:49:51 -0700 Subject: [PATCH] Use -m flag on rabbitmq-plugins command for managing rabbitmq_plugin resources Use the -m flag for calls to the rabbitmq-plugins command, which enables minimal output mode. This is much easier and more reliable to parse. Fixes an issue under RMQ 3.4.0 where rabbitmq_plugin resources were being enabled on every Puppet run, even though they are already enabled. --- lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb b/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb index eefc9fb25..a771a602f 100644 --- a/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb +++ b/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb @@ -21,8 +21,8 @@ defaultfor :feature => :posix def self.instances - rabbitmqplugins('list', '-E').split(/\n/).map do |line| - if line.split(/\s+/)[1] =~ /^(\S+)$/ + rabbitmqplugins('list', '-E', '-m').split(/\n/).map do |line| + if line =~ /^(\S+)$/ new(:name => $1) else raise Puppet::Error, "Cannot parse invalid plugins line: #{line}" @@ -39,8 +39,8 @@ def destroy end def exists? - rabbitmqplugins('list', '-E').split(/\n/).detect do |line| - line.split(/\s+/)[1].match(/^#{resource[:name]}$/) + rabbitmqplugins('list', '-E', '-m').split(/\n/).detect do |line| + line.match(/^#{resource[:name]}$/) end end