SuperTux88's Diaspora Saltstack 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.

51 lines
1.3KB

  1. # frozen_string_literal: true
  2. control 'diaspora configuration' do
  3. title 'should match desired lines'
  4. describe file('/srv/diaspora/config/database.yml') do
  5. it { should be_file }
  6. it { should be_owned_by 'diaspora' }
  7. it { should be_grouped_into 'root' }
  8. its('mode') { should cmp '0600' }
  9. its('content') do
  10. should include '# This file is managed by Salt! Do not edit by hand!'
  11. end
  12. its('content') do
  13. should include <<~CONTENT
  14. postgresql: &postgresql
  15. adapter: postgresql
  16. host: localhost
  17. port: 5432
  18. username: diaspora
  19. password: "secret"
  20. encoding: unicode
  21. CONTENT
  22. end
  23. end
  24. ca_file =
  25. case platform[:family]
  26. when 'debian', 'arch'
  27. '/etc/ssl/certs/ca-certificates.crt'
  28. when 'redhat'
  29. '/etc/pki/tls/certs/ca-bundle.crt'
  30. end
  31. describe file('/srv/diaspora/config/diaspora.yml') do
  32. it { should be_file }
  33. it { should be_owned_by 'diaspora' }
  34. it { should be_grouped_into 'root' }
  35. its('mode') { should cmp '0600' }
  36. its('content') do
  37. should include '# This file is managed by Salt! Do not edit by hand!'
  38. end
  39. its('content') { should include 'rails_environment: production' }
  40. its('content') { should include "certificate_authorities: #{ca_file}" }
  41. end
  42. end