Skip to content

Commit

Permalink
Fix rabbitmq_exchange create command
Browse files Browse the repository at this point in the history
Without this patch, the rabbitmq_exchange provider tries to call
rabbitmqadmin with the optional parameters internal, auto_delete, and
durable parameters set to empty, which results in an error:
`[u'not_boolean', u'']`. This patch changes the command to only use
call those parameters if they were specified by the user, otherwise the
default values will be used.
  • Loading branch information
cmurphy committed May 29, 2015
1 parent cc4956d commit d019865
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ def create
if arguments.nil?
arguments = {}
end
rabbitmqadmin('declare', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", "type=#{resource[:type]}", "internal=#{resource[:internal]}", "durable=#{resource[:durable]}", "auto_delete=#{resource[:auto_delete]}", "arguments=#{arguments.to_json}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf')
cmd = ['declare', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", "type=#{resource[:type]}",]
cmd << "internal=#{resource[:internal]}" if resource[:internal]
cmd << "durable=#{resource[:durable]}" if resource[:durable]
cmd << "auto_delete=#{resource[:auto_delete]}" if resource[:auto_delete]
cmd += ["arguments=#{arguments.to_json}", '-c', '/etc/rabbitmq/rabbitmqadmin.conf']
rabbitmqadmin(*cmd)
@property_hash[:ensure] = :present
end

Expand Down

0 comments on commit d019865

Please sign in to comment.