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

50 lines
1.4KB

  1. # frozen_string_literal: true
  2. # Overide by OS
  3. keyfile = 'keyfile '
  4. driftfile = '/var/lib/chrony/'
  5. logdir = 'logdir /var/log/chrony'
  6. confd = nil
  7. case platform[:name]
  8. when 'debian', 'ubuntu'
  9. config_file = '/etc/chrony/chrony.conf'
  10. keyfile += '/etc/chrony/chrony.keys'
  11. driftfile += 'chrony.drift'
  12. when 'gentoo'
  13. config_file = '/etc/chrony/chrony.conf'
  14. keyfile += '/etc/chrony.keys'
  15. driftfile += 'drift'
  16. when 'suse'
  17. config_file = '/etc/chrony.conf'
  18. keyfile += '/etc/chrony.keys'
  19. driftfile += 'drift'
  20. confd = '/etc/chrony.d'
  21. else
  22. config_file = '/etc/chrony.conf'
  23. keyfile += '/etc/chrony.keys'
  24. driftfile += 'drift'
  25. end
  26. control 'Chrony configuration' do
  27. title 'should match desired lines'
  28. describe file(config_file) do
  29. it { should be_file }
  30. it { should be_owned_by 'root' }
  31. it { should be_grouped_into 'root' }
  32. its('mode') { should cmp '0644' }
  33. its('content') { should include keyfile }
  34. its('content') { should include driftfile }
  35. its('content') { should include logdir }
  36. its('content') { should include 'server 0.debian.pool.ntp.org iburst' }
  37. its('content') { should include 'server 1.centos.pool.ntp.org' }
  38. its('content') { should include 'pool 0.debian.pool.ntp.org iburst' }
  39. its('content') { should include 'pool 1.centos.pool.ntp.org' }
  40. end
  41. if !confd.nil?
  42. describe directory(confd) do
  43. its('size') { should be 0 }
  44. end
  45. end
  46. end