Saltstack Official Apache 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.

config_spec.rb 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # frozen_string_literal: true
  2. # Overide by OS
  3. control 'apache configuration' do
  4. title 'should match desired lines'
  5. case platform[:family]
  6. when 'debian', 'suse'
  7. vhostdir = '/etc/apache2/sites-available'
  8. logrotatedir = '/etc/logrotate.d/apache2'
  9. moddir = '/etc/apache2/mods-enabled'
  10. sitesdir = '/etc/apache2/sites-enabled'
  11. when 'redhat', 'fedora'
  12. vhostdir = '/etc/httpd/vhosts.d'
  13. logrotatedir = '/etc/logrotate.d/httpd'
  14. moddir = '/etc/httpd/conf.modules.d'
  15. sitesdir = '/etc/httpd/sites-enabled'
  16. when 'gentoo'
  17. vhostdir = '/etc/apache2/vhosts.d'
  18. logrotatedir = '/etc/logrotate.d/apache2'
  19. moddir = '/etc/apache2/mods-enabled'
  20. sitesdir = '/etc/apache2/sites-enabled'
  21. # `linux` here is sufficient for `arch`
  22. when 'linux', 'arch'
  23. vhostdir = '/etc/httpd/conf/vhosts'
  24. logrotatedir = '/etc/logrotate.d/httpd'
  25. moddir = '/etc/httpd/conf.modules.d'
  26. sitesdir = '/etc/httpd/sites-enabled'
  27. when 'bsd'
  28. vhostdir = '/usr/local/etc/apache24/Includes'
  29. # logrotatedir = ?
  30. # moddir = '?'
  31. # sitesdir = '?'
  32. end
  33. describe file(vhostdir) do
  34. it { should exist }
  35. it { should be_directory }
  36. its('type') { should eq :directory }
  37. end
  38. describe file(logrotatedir) do
  39. it { should exist }
  40. its('type') { should eq :file }
  41. end
  42. describe file(moddir) do
  43. it { should exist }
  44. it { should be_directory }
  45. its('type') { should eq :directory }
  46. end
  47. describe file(sitesdir) do
  48. it { should exist }
  49. it { should be_directory }
  50. its('type') { should eq :directory }
  51. end
  52. end
  53. control 'apache configuration (unique)' do
  54. title 'should be valid'
  55. case platform[:family]
  56. when 'debian'
  57. config_file = '/etc/apache2/apache2.conf'
  58. wwwdir = '/srv'
  59. when 'suse'
  60. config_file = '/etc/apache2/httpd.conf'
  61. wwwdir = '/srv/www'
  62. when 'redhat', 'fedora'
  63. config_file = '/etc/httpd/conf/httpd.conf'
  64. wwwdir = '/var/www'
  65. when 'gentoo'
  66. config_file = '/etc/apache2/httpd.conf'
  67. wwwdir = '/var/www'
  68. when 'linux', 'arch'
  69. config_file = '/etc/httpd/conf/httpd.conf'
  70. wwwdir = '/srv/http'
  71. when 'bsd'
  72. config_file = '/usr/local/etc/apache24/httpd.conf'
  73. wwwdir = '/usr/local/www/apache24/'
  74. end
  75. describe file(config_file) do
  76. it { should be_file }
  77. it { should be_grouped_into 'root' }
  78. its('mode') { should cmp '0644' }
  79. its('content') do
  80. should include(
  81. 'This file is managed by Salt! Do not edit by hand!'
  82. )
  83. end
  84. end
  85. describe file(wwwdir) do
  86. it { should exist }
  87. it { should be_directory }
  88. its('type') { should eq :directory }
  89. end
  90. end