File tree Expand file tree Collapse file tree 7 files changed +44
-10
lines changed
Expand file tree Collapse file tree 7 files changed +44
-10
lines changed Original file line number Diff line number Diff line change @@ -880,23 +880,23 @@ Default value: `undef`
880880
881881Data type: ` Optional[Stdlib::Absolutepath] `
882882
883- The full path to the chronyd options file, typically /etc/sysconfig/chronyd
883+ The full path to the chronyd options file, typically /etc/sysconfig/chronyd on RedHat, /etc/default/chrony on Debian
884884
885885Default value: ` undef `
886886
887887##### <a name =" -chrony--options " ></a >` options `
888888
889- Data type: ` Optional[String[1] ] `
889+ Data type: ` Optional[String] `
890890
891- Options to pass to the chrony daemon via /etc/sysconfig/chronyd file.
891+ Options to pass to the chrony daemon via $options_file file.
892892
893893Default value: ` undef `
894894
895895##### <a name =" -chrony--options_template " ></a >` options_template `
896896
897897Data type: ` String[1] `
898898
899- This determines which template puppet should use for the chrony options (sysconfig) file.
899+ This determines which template puppet should use for the chrony options (sysconfig|default ) file.
900900
901901Default value: ` 'chrony/chronyd.epp' `
902902
Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ chrony::leapsectz: right/UTC
55chrony::makestep_seconds : 1
66chrony::maxupdateskew : 100.0
77chrony::ntsdumpdir : /var/lib/chrony
8+ chrony::options_template : chrony/chronyd_default.epp
9+ chrony::options_file : /etc/default/chrony
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ chrony::config_keys: /etc/chrony.keys
44chrony::config : /etc/chrony.conf
55chrony::wait_manage : true
66chrony::options_file : /etc/sysconfig/chronyd
7+ chrony::options : ' '
Original file line number Diff line number Diff line change 3636 }
3737 }
3838
39- if $chrony::options_file {
39+ if $chrony::options_file and $chrony::options {
4040 file { $chrony::options_file :
4141 ensure => file ,
4242 owner => 0,
Original file line number Diff line number Diff line change 256256# @param acquisitionport
257257# Sets the acquisitionport for client queries
258258# @param options_file
259- # The full path to the chronyd options file, typically /etc/sysconfig/chronyd
259+ # The full path to the chronyd options file, typically /etc/sysconfig/chronyd on RedHat, /etc/default/chrony on Debian
260260# @param options
261- # Options to pass to the chrony daemon via /etc/sysconfig/chronyd file.
261+ # Options to pass to the chrony daemon via $options_file file.
262262# @param options_template
263- # This determines which template puppet should use for the chrony options (sysconfig) file.
263+ # This determines which template puppet should use for the chrony options (sysconfig|default ) file.
264264# @param ptpport
265265# open port to send and receive NTP messages contained in PTP event messages (NTP-over-PTP)
266266# @param ptpdomain
348348 Optional[Integer[0]] $ntsrotate = undef ,
349349 Optional[Integer[1,65535]] $acquisitionport = undef ,
350350 Optional[Stdlib::Absolutepath] $options_file = undef ,
351- Optional[String[1]] $options = undef ,
351+ Optional[String] $options = undef ,
352352 String[1] $options_template = ' chrony/chronyd.epp' ,
353353 Optional[Integer[0]] $ptpport = undef ,
354354 Optional[Integer[0,255]] $ptpdomain = undef ,
Original file line number Diff line number Diff line change 415415 )
416416 end
417417
418+ it 'does not create /etc/default/chrony' do
419+ is_expected . not_to contain_file ( '/etc/default/chrony' )
420+ end
421+
418422 if ( facts [ :os ] [ 'release' ] [ 'major' ] = '8' )
419423 context 'on RedHat 8 family with default parameters' do
420424 it 'contains an empty OPTIONS line' do
439443 with_content ( %r{^OPTIONS="-4 -u chrony"$} )
440444 end
441445 end
446+ when 'Debian'
447+ it 'does not create /etc/sysconfig/chronyd' do
448+ is_expected . not_to contain_file ( '/etc/sysconfig/chronyd' )
449+ end
450+
451+ context 'with no options parameter' do
452+ it {
453+ is_expected . not_to contain_file ( '/etc/default/chrony' )
454+ }
455+ end
456+
457+ context 'with custom options parameter' do
458+ let ( :params ) { { options : '-4 -u chrony' } }
459+
460+ it 'contains the custom OPTIONS line' do
461+ is_expected . to contain_file ( '/etc/default/chrony' ) .
462+ with_content ( %r{^DAEMON_OPTS="-4 -u chrony"$} ) .
463+ with_ensure ( 'file' ) .
464+ with_owner ( '0' ) .
465+ with_group ( '0' ) .
466+ with_mode ( '0644' )
467+ end
468+ end
442469 else
443- it 'on non-RedHat families' do
470+ it 'on non-RedHat/Debian families' do
444471 is_expected . not_to contain_file ( '/etc/sysconfig/chronyd' )
472+ is_expected . not_to contain_file ( '/etc/default/chrony' )
445473 end
446474 end
447475 end
Original file line number Diff line number Diff line change 1+ # This file is managed by Puppet. Do not edit!
2+ # Command-line options for chronyd
3+ DAEMON_OPTS="<%= $chrony::options %>"
You can’t perform that action at this time.
0 commit comments