Saltstack Official Nginx Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9KB

  1. # frozen_string_literal: true
  2. # Set defaults, use debian as base
  3. # Override by OS Family
  4. case platform[:family]
  5. when 'redhat', 'centos', 'fedora'
  6. server_available = '/etc/nginx/conf.d'
  7. server_enabled = '/etc/nginx/conf.d'
  8. passenger_mod = '/usr/lib64/nginx/modules/ngx_http_passenger_module.so'
  9. passenger_root = '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini'
  10. passenger_config_file = '/etc/nginx/conf.d/passenger.conf'
  11. should_not_exist_file = '/etc/nginx/conf.d/mod-http-passenger.conf'
  12. when 'debian', 'ubuntu'
  13. server_available = '/etc/nginx/sites-available'
  14. server_enabled = '/etc/nginx/sites-enabled'
  15. passenger_mod = '/usr/lib/nginx/modules/ngx_http_passenger_module.so'
  16. passenger_root = '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini'
  17. passenger_config_file = '/etc/nginx/conf.d/mod-http-passenger.conf'
  18. should_not_exist_file = '/etc/nginx/conf.d/passenger.conf'
  19. end
  20. control 'Passenger configuration' do
  21. title 'should match desired lines'
  22. # main configuration
  23. describe file('/etc/nginx/nginx.conf') do
  24. its('content') { should include "load_module #{passenger_mod}" }
  25. end
  26. describe file(passenger_config_file) do
  27. it { should be_file }
  28. it { should be_owned_by 'root' }
  29. it { should be_grouped_into 'root' }
  30. its('mode') { should cmp '0644' }
  31. its('content') { should include "passenger_root #{passenger_root};" }
  32. its('content') { should include 'passenger_ruby /usr/bin/ruby;' }
  33. end
  34. describe file(should_not_exist_file) do
  35. it { should_not exist }
  36. end
  37. # sites configuration
  38. [server_available, server_enabled].each do |dir|
  39. describe file "#{dir}/default" do
  40. it { should_not exist }
  41. end
  42. describe file "#{dir}/mysite" do
  43. it { should be_file }
  44. it { should be_owned_by 'root' }
  45. it { should be_grouped_into 'root' }
  46. its('mode') { should cmp '0644' }
  47. its('content') { should include 'passenger_enabled on;' }
  48. end
  49. end
  50. end