Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init: change refclocks data type to Hash #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 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.
This should be a Hash of hardware reference clock drivers to use. The hash
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
9 changes: 4 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,14 @@
# @param minsamples
# 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.
# This should be a Hash of hardware reference clock drivers to use. The hash
# 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