From e709ba7271ede8c58155cdbc14f15da87519c04f Mon Sep 17 00:00:00 2001 From: Edmund Rhudy Date: Fri, 26 Dec 2014 18:30:12 -0500 Subject: [PATCH] my first set of changes for the user tag idempotence issue --- lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb b/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb index 8a8e9f41c..7f7f81eb4 100644 --- a/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb +++ b/lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb @@ -111,6 +111,12 @@ def get_user_tags match = rabbitmqctl('-q', 'list_users').split(/\n/).collect do |line| line.match(/^#{Regexp.escape(resource[:name])}\s+\[(.*?)\]/) end.compact.first - Set.new(match[1].split(/, /)) if match + if match + # RabbitMQ 3.3.5 and up separate tags with ', ' + # 3.3.4 just separates with space + # this splits by space and then strips word-final commas + # (if you're ending a valid tag name with a comma, why) + Set.new(match[1].split(' ')).map{|x| x.gsub(/,$/, '')} + end end end