Skip to content

Commit

Permalink
add Why-run support
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhem committed Sep 12, 2013
1 parent 605c676 commit 56350e5
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions providers/default.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
include Chef::DSL::IncludeRecipe

# Support whyrun
def whyrun_supported?
true
end

action :install do
include_recipe "uwsgi::emperor"

if new_resource.file
remote_file "config file for #{new_resource.name}" do
path ::File.join(node['uwsgi']['emperor']['conf_dir'], new_resource.name + ::File.extname(new_resource.file))
source new_resource.file
owner "root"
group "root"
mode "0644"
notifies :reload, "service[uwsgi]"
converge_by ("Create #{new_resource.name} with remote_file") do
remote_file "config file for #{new_resource.name}" do
path ::File.join(node['uwsgi']['emperor']['conf_dir'], new_resource.name + ::File.extname(new_resource.file))
source new_resource.file
owner "root"
group "root"
mode "0644"
notifies :reload, "service[uwsgi]"
end
end
elsif new_resource.parameters
include_recipe "conffile"

conffile_ini "config file for #{new_resource.name}" do
path ::File.join(node['uwsgi']['emperor']['conf_dir'], "#{new_resource.name}.ini")
parameters new_resource.parameters
notifies :reload, "service[uwsgi]"
converge_by ("Create #{new_resource.name} with conffile") do
conffile_ini "config file for #{new_resource.name}" do
path ::File.join(node['uwsgi']['emperor']['conf_dir'], "#{new_resource.name}.ini")
parameters new_resource.parameters
notifies :reload, "service[uwsgi]"
end
end
end
end

0 comments on commit 56350e5

Please sign in to comment.