Skip to content

Commit

Permalink
fix refclock generation
Browse files Browse the repository at this point in the history
This updates the refclock parameter data types to be a hash which
matches the examples and updates the template to properly generate
multiple refclock entries.

This looks to have broken via a combination of #141 and #79. Rather than
restore the full variations that were supported prior to #79 a simplified
hash structure was chosen.

Fixes #189

Signed-off-by: Ben Magistro <[email protected]>
  • Loading branch information
bmagistro committed Jan 4, 2024
1 parent 7fd4032 commit 9922326
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
7 changes: 3 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,17 +507,16 @@ Default value: `undef`

##### <a name="-chrony--refclocks"></a>`refclocks`

Data type: `Array`
Data type: `Hash`

This should be a Hash of hardware reference clock drivers to use. They hash
can either list a single list of options for the driver, or any array of
multiple options if the same driver is used for multiple hardware clocks.
should be an array of hardware clocks and their options for that driver.

Example:
```puppet
refclocks => { 'PPS' => [ '/dev/pps0 lock NMEA refid GPS',
'/dev/pps1:clear refid GPS2' ],
'SHM' => '0 offset 0.5 delay 0.2 refid NMEA noselect' }
'SHM' => [ '0 offset 0.5 delay 0.2 refid NMEA noselect' ] }
```

Default value: `[]`
Expand Down
7 changes: 3 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,13 @@
# Specifies the minimum number of readings kept for tracking of the NIC clock.
# @param refclocks
# This should be a Hash of hardware reference clock drivers to use. They hash
# can either list a single list of options for the driver, or any array of
# multiple options if the same driver is used for multiple hardware clocks.
# should be an array of hardware clocks and their options for that driver.
#
# Example:
# ```puppet
# refclocks => { 'PPS' => [ '/dev/pps0 lock NMEA refid GPS',
# '/dev/pps1:clear refid GPS2' ],
# 'SHM' => '0 offset 0.5 delay 0.2 refid NMEA noselect' }
# 'SHM' => [ '0 offset 0.5 delay 0.2 refid NMEA noselect' ] }
# ```
# @param makestep_seconds
# Configures the [`makestep`](https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#makestep) `threshold`.
Expand Down Expand Up @@ -275,7 +274,7 @@
String[1] $package_name = 'chrony',
Optional[String] $package_source = undef,
Optional[String] $package_provider = undef,
Array $refclocks = [],
Hash $refclocks = {},
Chrony::Servers $peers = [],
Chrony::Servers $servers = {
'0.pool.ntp.org' => ['iburst'],
Expand Down
6 changes: 4 additions & 2 deletions templates/chrony.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ log <%= $chrony::log_options %>
<% } -%>
<% unless $chrony::refclocks.empty { -%>

<% $chrony::refclocks.each |$driver| { -%>
refclock <%= $driver.flatten.join(' ') %>
<% $chrony::refclocks.each |$driver, $clocks| { -%>
<% $clocks.each |$clock| { -%>
refclock <%= $driver %> <%= $clock %>
<% } -%>
<% } -%>
<% } -%>
<% if $chrony::lock_all { -%>
Expand Down

0 comments on commit 9922326

Please sign in to comment.