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

Arch Linux: also manage chrony-wait.service #141

Merged
merged 9 commits into from
Mar 7, 2022
Merged
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
7 changes: 3 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
84 changes: 6 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
32 changes: 10 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 0 additions & 2 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
--fail-on-warnings
--no-parameter_documentation-check
--no-parameter_types-check
6 changes: 6 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
31 changes: 15 additions & 16 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

* `chrony::config`: Configures chrony
* `chrony::install`: Installs chrony
* `chrony::params`: chrony class parameters
* `chrony::service`: Manages the chrony service

### Functions
Expand Down Expand Up @@ -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: `[]`

##### <a name="cmdport"></a>`cmdport`

Expand All @@ -235,7 +234,7 @@ Default value: ``undef``

##### <a name="commandkey"></a>`commandkey`

Data type: `Any`
Data type: `NotUndef`

This sets the key ID used by chronyc to authenticate to chronyd.

Expand All @@ -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'`

##### <a name="config_template"></a>`config_template`

Expand All @@ -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'`

##### <a name="config_keys_manage"></a>`config_keys_manage`

Expand All @@ -297,23 +296,23 @@ 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`

##### <a name="config_keys_group"></a>`config_keys_group`

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`

##### <a name="config_keys_mode"></a>`config_keys_mode`

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'`

##### <a name="keys"></a>`keys`

Expand Down Expand Up @@ -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'`

##### <a name="package_source"></a>`package_source`

Expand Down Expand Up @@ -430,7 +429,7 @@ Default value: `{}`

##### <a name="refclocks"></a>`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
Expand Down Expand Up @@ -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'`

##### <a name="wait_enable"></a>`wait_enable`

Expand All @@ -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``

##### <a name="wait_name"></a>`wait_name`

Expand Down Expand Up @@ -619,7 +618,7 @@ Data type: `Boolean`

Determines whether to log client accesses.

Default value: `$chrony::params::clientlog`
Default value: ``false``

##### <a name="clientloglimit"></a>`clientloglimit`

Expand Down Expand Up @@ -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``

##### <a name="hwtimestamps"></a>`hwtimestamps`

Expand All @@ -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``

##### <a name="maxupdateskew"></a>`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``

Expand Down
1 change: 1 addition & 0 deletions data/Archlinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions functions/server_array_to_hash.pp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'],
Expand Down
Loading