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.

40 lines
951B

  1. # frozen_string_literal: true
  2. control 'apache configuration' do
  3. title 'should match desired lines'
  4. config_file =
  5. case platform[:family]
  6. when 'debian'
  7. '/etc/apache2/apache2.conf'
  8. when 'redhat', 'fedora'
  9. '/etc/httpd/conf/httpd.conf'
  10. when 'suse'
  11. '/etc/apache2/httpd.conf'
  12. # `linux` here is sufficient for `arch`
  13. when 'linux'
  14. '/etc/httpd/conf/httpd.conf'
  15. end
  16. describe file(config_file) do
  17. it { should be_file }
  18. it { should be_owned_by 'root' }
  19. it { should be_grouped_into 'root' }
  20. its('mode') { should cmp '0644' }
  21. its('content') do
  22. should include(
  23. 'This file is managed by Salt! Do not edit by hand!'
  24. )
  25. end
  26. end
  27. end
  28. control 'apache configuration' do
  29. title 'should be valid'
  30. describe command('apachectl -t') do
  31. its('stdout') { should eq '' }
  32. its('stderr') { should include 'Syntax OK' }
  33. its('exit_status') { should eq 0 }
  34. end
  35. end