Skip to content

Commit

Permalink
Let templates notify the logdir existence test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Udo Juettner committed Aug 2, 2013
1 parent 402ab7e commit dda6651
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions apache2/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
end
end

execute 'logdir_existence_and_restart_apache2' do
command "ls -la #{node[:apache][:log_dir]}"
action :nothing
notifies :restart, resources(:service => 'apache2')
end

if platform?('centos', 'redhat', 'fedora', 'amazon')
directory node[:apache][:log_dir] do
mode 0755
Expand Down Expand Up @@ -120,7 +126,7 @@
owner 'root'
group 'root'
mode 0644
notifies :restart, "service[apache2]"
notifies :run, resources(:execute => 'logdir_existence_and_restart_apache2')
end

template 'security' do
Expand All @@ -130,7 +136,7 @@
group 'root'
mode 0644
backup false
notifies :restart, "service[apache2]"
notifies :run, resources(:execute => 'logdir_existence_and_restart_apache2')
end

template 'charset' do
Expand All @@ -140,23 +146,23 @@
group 'root'
mode 0644
backup false
notifies :restart, "service[apache2]"
notifies :run, resources(:execute => 'logdir_existence_and_restart_apache2')
end

template "#{node[:apache][:dir]}/ports.conf" do
source 'ports.conf.erb'
group 'root'
owner 'root'
mode 0644
notifies :restart, "service[apache2]"
notifies :run, resources(:execute => 'logdir_existence_and_restart_apache2')
end

template "#{node[:apache][:dir]}/sites-available/default" do
source 'default-site.erb'
owner 'root'
group 'root'
mode 0644
notifies :restart, "service[apache2]"
notifies :run, resources(:execute => 'logdir_existence_and_restart_apache2')
end

include_recipe 'apache2::mod_status'
Expand All @@ -182,9 +188,8 @@
# uncomment to get working example site on centos/redhat/fedora/amazon
#apache_site 'default'

execute "check existence of #{node[:apache][:log_dir]}" do
command "ls -la #{node[:apache][:log_dir]}"
notifies :start, resources(:service => 'apache2')
execute 'logdir_existence_and_restart_apache2' do
action :run
end

file "#{node[:apache][:document_root]}/index.html" do
Expand Down

0 comments on commit dda6651

Please sign in to comment.