Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds policy apply_to option #158

Merged
merged 1 commit into from
Dec 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions providers/policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def policy_exists?(vhost, name)
unless policy_exists?(new_resource.vhost, new_resource.policy)
cmd = 'rabbitmqctl set_policy'
cmd << " -p #{new_resource.vhost}" unless new_resource.vhost.nil?
cmd << " --apply-to #{new_resource.apply_to}" if new_resource.apply_to
cmd << " #{new_resource.policy}"
cmd << " \"#{new_resource.pattern}\""
cmd << " '{"
Expand Down
1 change: 1 addition & 0 deletions resources/policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
attribute :params, :kind_of => Hash
attribute :priority, :kind_of => Integer
attribute :vhost, :kind_of => String
attribute :apply_to, :kind_of => String, :equal_to => ['all', 'queues', 'exchanges']
7 changes: 7 additions & 0 deletions test/cookbooks/rabbitmq_test/recipes/lwrps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@
mode "0755"
action :create
end

rabbitmq_policy "rabbitmq_cluster" do
pattern 'cluster.*'
params 'ha-mode' => 'all', 'ha-sync-mode' => 'automatic'
apply_to 'queues'
action :set
end
4 changes: 4 additions & 0 deletions test/integration/lwrps/rspec/lwrps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
describe command('/usr/local/bin/rabbitmqadmin --version') do
it { should return_exit_status 0 }
end

describe command('/usr/local/bin/rabbitmqctl list_policies') do
its(:stdout) { should match /\/\s+rabbitmq_cluster\s+queues\s+cluster\.\*\s+{"ha-mode":"all","ha-sync-mode":"automatic"}\s+0/ }
end