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 <koncept1@gmail.com>
  • Loading branch information
bmagistro authored and kenyon committed Feb 26, 2024
1 parent ec083a1 commit ac8ed0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
9 changes: 4 additions & 5 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,20 +507,19 @@ 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: `[]`
Default value: `{}`

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

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 ac8ed0f

Please sign in to comment.