Saltstack Official Chrony Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

config_spec.rb 1.2KB

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