Skip to content

Commit

Permalink
previous version using only_if and not_if didn't seem to work correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneiderhan committed Jun 5, 2012
1 parent bc93a9d commit f6f0faf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions providers/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
#

action :enable do
execute "rabbitmq-plugins enable #{new_resource.plugin}" do
not_if "rabbitmq-plugins list #{new_resource.plugin} | grep '\\[[Ee]\\] #{new_resource.plugin}'"
Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'."
new_resource.updated_by_last_action(true)
unless system("rabbitmq-plugins list #{new_resource.plugin} | grep '\\[[Ee]\\] #{new_resource.plugin}'")
execute "rabbitmq-plugins enable #{new_resource.plugin}" do
Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'."
new_resource.updated_by_last_action(true)
end
end
end

action :disable do
execute "rabbitmq-plugins disable #{new_resource.plugin}" do
only_if "rabbitmq-plugins list #{new_resource.plugin} | grep '\\[[Ee]\\] #{new_resource.plugin}'"
Chef::Log.info "Disabling RabbitMQ plugin '#{new_resource.plugin}'."
new_resource.updated_by_last_action(true)
if system("rabbitmq-plugins list #{new_resource.plugin} | grep '\\[[Ee]\\] #{new_resource.plugin}'")
execute "rabbitmq-plugins disable #{new_resource.plugin}" do
Chef::Log.info "Disabling RabbitMQ plugin '#{new_resource.plugin}'."
new_resource.updated_by_last_action(true)
end
end
end

0 comments on commit f6f0faf

Please sign in to comment.