Skip to content

Commit

Permalink
Allow enabling and disabling 'default' nginx_site
Browse files Browse the repository at this point in the history
The nxensite and nxdissite scripts prepend a '000' priority to the
symlink name for the default site. Adding this to the guard conditions
for the nginx_site definition lets us enable and disable the default
site properly.
  • Loading branch information
Nate Smith committed Feb 13, 2013
1 parent f6059cd commit 934bd3a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions definitions/nginx_site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@
execute "nxensite #{params[:name]}" do
command "/usr/sbin/nxensite #{params[:name]}"
notifies :reload, "service[nginx]", params[:timing]
not_if do ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") end
not_if do
::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") ||
::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{params[:name]}")
end
end
else
execute "nxdissite #{params[:name]}" do
command "/usr/sbin/nxdissite #{params[:name]}"
notifies :reload, "service[nginx]", params[:timing]
only_if do ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") end
only_if do
::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") ||
::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{params[:name]}")
end
end
end
end

0 comments on commit 934bd3a

Please sign in to comment.