diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 048d2b5..25743a1 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:
```sh
-export PUPPET_VERSION="~> 5.5.6"
+export PUPPET_GEM_VERSION="~> 5.5.6"
```
You can install all needed gems for spec tests into the modules directory by
@@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this
with:
```sh
-BEAKER_setfile=debian10-x64 bundle exec rake beaker
+BEAKER_setfile=debian11-64 bundle exec rake beaker
```
You can replace the string `debian10` with any common operating system.
The following strings are known to work:
-* ubuntu1604
* ubuntu1804
* ubuntu2004
-* debian9
* debian10
+* debian11
* centos7
* centos8
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2e9c7b0..48fcfea 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,84 +7,12 @@ name: CI
on: pull_request
concurrency:
- group: ${{ github.head_ref }}
+ group: ${{ github.ref_name }}
cancel-in-progress: true
jobs:
- setup_matrix:
- name: 'Setup Test Matrix'
- runs-on: ubuntu-latest
- timeout-minutes: 40
- outputs:
- puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
- github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
- env:
- BUNDLE_WITHOUT: development:system_tests:release
- steps:
- - uses: actions/checkout@v2
- - name: Setup ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.0'
- bundler-cache: true
- - name: Run static validations
- run: bundle exec rake validate lint check
- - name: Run rake rubocop
- run: bundle exec rake rubocop
- - name: Setup Test Matrix
- id: get-outputs
- run: bundle exec metadata2gha --use-fqdn --pidfile-workaround CentOS
-
- unit:
- needs: setup_matrix
- runs-on: ubuntu-latest
- timeout-minutes: 40
- strategy:
- fail-fast: false
- matrix:
- include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
- env:
- BUNDLE_WITHOUT: development:system_tests:release
- PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
- name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
- steps:
- - uses: actions/checkout@v2
- - name: Setup ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: ${{ matrix.ruby }}
- bundler-cache: true
- - name: Run tests
- run: bundle exec rake parallel_spec
-
- acceptance:
- needs: setup_matrix
- runs-on: ubuntu-latest
- env:
- BUNDLE_WITHOUT: development:test:release
- strategy:
- fail-fast: false
- matrix:
- include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
- name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
- steps:
- - uses: actions/checkout@v2
- - name: Setup ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.0'
- bundler-cache: true
- - name: Run tests
- run: bundle exec rake beaker
- env:
- BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
- BEAKER_setfile: ${{ matrix.setfile.value }}
-
- tests:
- needs:
- - unit
- - acceptance
- runs-on: ubuntu-latest
- name: Test suite
- steps:
- - run: echo Test suite completed
+ puppet:
+ name: Puppet
+ uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
+ with:
+ pidfile_workaround: 'CentOS'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 664ba69..15f1721 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,26 +9,14 @@ on:
tags:
- '*'
-env:
- BUNDLE_WITHOUT: development:test:system_tests
-
jobs:
- deploy:
- name: 'deploy to forge'
- runs-on: ubuntu-latest
- if: github.repository_owner == 'voxpupuli'
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- - name: Setup Ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '2.7'
- bundler-cache: true
- - name: Build and Deploy
- env:
- # Configure secrets here:
- # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
- BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
- BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
- run: bundle exec rake module:push
+ release:
+ name: Release
+ uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
+ with:
+ allowed_owner: 'voxpupuli'
+ secrets:
+ # Configure secrets here:
+ # https://docs.github.com/en/actions/security-guides/encrypted-secrets
+ username: ${{ secrets.PUPPET_FORGE_USERNAME }}
+ api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}
diff --git a/.msync.yml b/.msync.yml
index a83abd9..968a936 100644
--- a/.msync.yml
+++ b/.msync.yml
@@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-modulesync_config_version: '5.1.0'
+modulesync_config_version: '5.2.0'
diff --git a/.puppet-lint.rc b/.puppet-lint.rc
index dd8272c..02a3e71 100644
--- a/.puppet-lint.rc
+++ b/.puppet-lint.rc
@@ -1,3 +1 @@
--fail-on-warnings
---no-parameter_documentation-check
---no-parameter_types-check
diff --git a/.sync.yml b/.sync.yml
index 29bd53e..43b0750 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,5 +1,11 @@
---
+.puppet-lint.rc:
+ enabled_lint_checks:
+ - parameter_documentation
+ - parameter_types
spec/spec_helper.rb:
mock_with: ':rspec'
.github/workflows/ci.yml:
pidfile_workaround: CentOS
+spec/spec_helper_acceptance.rb:
+ unmanaged: false
diff --git a/Dockerfile b/Dockerfile
index e3cf307..8dd82d6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ WORKDIR /opt/puppet
# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39
RUN mkdir -p /etc/sv
-ARG PUPPET_VERSION="~> 6.0"
+ARG PUPPET_GEM_VERSION="~> 6.0"
ARG PARALLEL_TEST_PROCESSORS=4
# Cache gems
diff --git a/Gemfile b/Gemfile
index b6dcf45..225c396 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-source ENV['GEM_SOURCE'] || "https://rubygems.org"
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
group :test do
gem 'voxpupuli-test', '~> 5.0', :require => false
@@ -28,7 +28,7 @@ end
gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]
-puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
+puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
gem 'puppet', puppetversion, :require => false, :groups => [:test]
# vim: syntax=ruby
diff --git a/REFERENCE.md b/REFERENCE.md
index 25d28c9..dedb109 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -14,7 +14,6 @@
* `chrony::config`: Configures chrony
* `chrony::install`: Installs chrony
-* `chrony::params`: chrony class parameters
* `chrony::service`: Manages the chrony service
### Functions
@@ -222,7 +221,7 @@ the time of generating the configuration. The argument of the allow or deny
commands can be an address, a partial address or a subnet (see manpage for more
details).
-Default value: `$chrony::params::cmdacl`
+Default value: `[]`
##### `cmdport`
@@ -235,7 +234,7 @@ Default value: ``undef``
##### `commandkey`
-Data type: `Any`
+Data type: `NotUndef`
This sets the key ID used by chronyc to authenticate to chronyd.
@@ -257,7 +256,7 @@ Data type: `Stdlib::Unixpath`
This sets the file to write chrony configuration into.
-Default value: `$chrony::params::config`
+Default value: `'/etc/chrony/chrony.conf'`
##### `config_template`
@@ -273,7 +272,7 @@ Data type: `Stdlib::Unixpath`
This sets the file to write chrony keys into.
-Default value: `$chrony::params::config_keys`
+Default value: `'/etc/chrony/chrony.keys'`
##### `config_keys_manage`
@@ -297,7 +296,7 @@ Data type: `Variant[Integer[0],String[1]]`
Specify unix owner of chrony keys file, defaults to 0.
-Default value: `$chrony::params::config_keys_owner`
+Default value: `0`
##### `config_keys_group`
@@ -305,7 +304,7 @@ Data type: `Variant[Integer[0],String[1]]`
Specify unix group of chrony keys files, defaults to 0 on ArchLinux and chrony on Redhat.
-Default value: `$chrony::params::config_keys_group`
+Default value: `0`
##### `config_keys_mode`
@@ -313,7 +312,7 @@ Data type: `Stdlib::Filemode`
Specify unix mode of chrony keys files, defaults to 0644 on ArchLinux and 0640 on Redhat.
-Default value: `$chrony::params::config_keys_mode`
+Default value: `'0640'`
##### `keys`
@@ -374,7 +373,7 @@ Data type: `String[1]`
This determines the name of the package to install.
-Default value: `$chrony::params::package_name`
+Default value: `'chrony'`
##### `package_source`
@@ -430,7 +429,7 @@ Default value: `{}`
##### `refclocks`
-Data type: `Any`
+Data type: `Array`
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
@@ -515,7 +514,7 @@ Data type: `String[1]`
This selects the name of the chrony service for puppet to manage.
-Default value: `$chrony::params::service_name`
+Default value: `'chronyd'`
##### `wait_enable`
@@ -539,7 +538,7 @@ Data type: `Boolean`
This selects if puppet should manage the chrony-wait service in the first place.
-Default value: `$chrony::params::wait_manage`
+Default value: ``false``
##### `wait_name`
@@ -619,7 +618,7 @@ Data type: `Boolean`
Determines whether to log client accesses.
-Default value: `$chrony::params::clientlog`
+Default value: ``false``
##### `clientloglimit`
@@ -647,7 +646,7 @@ Keep RTC in UTC instead of local time.
If not set, chrony's, default will be used. On Arch Linux the default is true instead.
See [rtconutc](https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#rtconutc)
-Default value: `$chrony::params::rtconutc`
+Default value: ``false``
##### `hwtimestamps`
@@ -664,13 +663,13 @@ Data type: `Optional[Stdlib::Unixpath]`
Directory to store measurement history in on exit.
-Default value: `$chrony::params::dumpdir`
+Default value: ``undef``
##### `maxupdateskew`
Data type: `Optional[Float]`
-
+Sets the threshold for determining whether an estimate might be so unreliable that it should not be used
Default value: ``undef``
diff --git a/data/Archlinux.yaml b/data/Archlinux.yaml
index 11ed31a..b8692a7 100644
--- a/data/Archlinux.yaml
+++ b/data/Archlinux.yaml
@@ -7,3 +7,4 @@ chrony::config_keys: /etc/chrony.keys
chrony::config: /etc/chrony.conf
chrony::dumpdir: /var/lib/chrony
chrony::rtconutc: true
+chrony::wait_manage: true
diff --git a/functions/server_array_to_hash.pp b/functions/server_array_to_hash.pp
index d368c62..1f35967 100644
--- a/functions/server_array_to_hash.pp
+++ b/functions/server_array_to_hash.pp
@@ -1,6 +1,7 @@
# @summary Function to normalise servers/pools/peers
#
# @api private
+# @return [Hash] returns the original hash or converts the array to an hash
function chrony::server_array_to_hash(Variant[Hash,Array] $servers, $options = []) >> Hash {
if $servers.is_a(Hash) {
$servers
diff --git a/manifests/init.pp b/manifests/init.pp
index 8e31a21..c9a9359 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -203,13 +203,15 @@
# interfaces or a hash of interfaces to their respective options.
# @param dumpdir
# Directory to store measurement history in on exit.
+# @param maxupdateskew
+# Sets the threshold for determining whether an estimate might be so unreliable that it should not be used
class chrony (
Array[Stdlib::IP::Address] $bindaddress = [],
Array[String] $bindcmdaddress = ['127.0.0.1', '::1'],
Optional[String] $initstepslew = undef,
Array[String] $cmdacl = [],
Optional[Stdlib::Port] $cmdport = undef,
- $commandkey = 0,
+ NotUndef $commandkey = 0,
Stdlib::Unixpath $config = '/etc/chrony/chrony.conf',
String[1] $config_template = 'chrony/chrony.conf.epp',
Stdlib::Unixpath $config_keys = '/etc/chrony/chrony.keys',
@@ -227,7 +229,7 @@
String[1] $package_name = 'chrony',
Optional[String] $package_source = undef,
Optional[String] $package_provider = undef,
- $refclocks = [],
+ Array $refclocks = [],
Chrony::Servers $peers = [],
Chrony::Servers $servers = {
'0.pool.ntp.org' => ['iburst'],
diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb
index 9a760ea..dc9d910 100644
--- a/spec/acceptance/class_spec.rb
+++ b/spec/acceptance/class_spec.rb
@@ -17,7 +17,7 @@ class { 'chrony': }
it { is_expected.to be_installed }
end
- if fact('os.family') == 'RedHat'
+ if %w[RedHat Archlinux].include?(fact('os.family'))
describe service('chronyd') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
@@ -53,7 +53,7 @@ class { 'chrony':
apply_manifest(pp, catch_changes: true)
end
- if fact('os.family') == 'RedHat'
+ if %w[RedHat Archlinux].include?(fact('os.family'))
describe service('chronyd') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
diff --git a/spec/classes/chrony_spec.rb b/spec/classes/chrony_spec.rb
index bb8201b..8c1cc7f 100644
--- a/spec/classes/chrony_spec.rb
+++ b/spec/classes/chrony_spec.rb
@@ -468,7 +468,7 @@
end
case facts[:os]['family']
- when 'RedHat', 'Suse'
+ when 'RedHat', 'Suse', 'Archlinux'
context 'using defaults' do
it do
is_expected.to contain_service('chrony-wait.service').with(
@@ -511,7 +511,7 @@
end
case facts[:os]['family']
- when 'RedHat', 'Suse'
+ when 'RedHat', 'Suse', 'Archlinux'
it do
is_expected.to contain_service('chrony-wait.service').with(
ensure: 'stopped',
@@ -531,7 +531,7 @@
end
case facts[:os]['family']
- when 'RedHat', 'Suse'
+ when 'RedHat', 'Suse', 'Archlinux'
it do
is_expected.to contain_service('chrony-wait.service').with(
ensure: 'running',
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 6855881..d3a6e23 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,5 +1,10 @@
# frozen_string_literal: true
+# Managed by modulesync - DO NOT EDIT
+# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
+
require 'voxpupuli/acceptance/spec_helper_acceptance'
configure_beaker
+
+Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }