9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

name: CI

on: pull_request
on:
pull_request: {}
push:
branches:
- main
- master

concurrency:
group: ${{ github.ref_name }}
Expand All @@ -13,6 +18,6 @@ concurrency:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
pidfile_workaround: 'false'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2
with:
allowed_owner: 'voxpupuli'
secrets:
Expand Down
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: '7.0.0'
modulesync_config_version: '7.3.0'
1 change: 1 addition & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
/.yardoc/
/.yardopts
/Dockerfile
/HISTORY.md
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v6.4.0](https://github.com/voxpupuli/puppet-systemd/tree/v6.4.0) (2024-02-24)

[Full Changelog](https://github.com/voxpupuli/puppet-systemd/compare/v6.3.0...v6.4.0)

**Implemented enhancements:**

- Support `StartLimitIntervalSec` and `StartLimitBurst` [\#412](https://github.com/voxpupuli/puppet-systemd/pull/412) ([traylenator](https://github.com/traylenator))
- unit type: add `ConditionPathIsMountPoint` [\#408](https://github.com/voxpupuli/puppet-systemd/pull/408) ([fragfutter](https://github.com/fragfutter))
- Allow percent \(%\) character in unit names. [\#401](https://github.com/voxpupuli/puppet-systemd/pull/401) ([traylenator](https://github.com/traylenator))

**Fixed bugs:**

- Support multiple Environment Settings [\#409](https://github.com/voxpupuli/puppet-systemd/pull/409) ([traylenator](https://github.com/traylenator))
- Deleting duplicate Key entries in types/unit/service.pp [\#407](https://github.com/voxpupuli/puppet-systemd/pull/407) ([C24-AK](https://github.com/C24-AK))
- systemd::cache = false result was vague. [\#403](https://github.com/voxpupuli/puppet-systemd/pull/403) ([traylenator](https://github.com/traylenator))

## [v6.3.0](https://github.com/voxpupuli/puppet-systemd/tree/v6.3.0) (2023-12-06)

[Full Changelog](https://github.com/voxpupuli/puppet-systemd/compare/v6.2.0...v6.3.0)
Expand Down
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group :test do
gem 'voxpupuli-test', '~> 7.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 3.0', :require => false
gem 'puppet_metadata', '~> 3.5', :require => false
end

group :development do
Expand All @@ -16,13 +16,11 @@ group :development do
end

group :system_tests do
gem 'voxpupuli-acceptance', '~> 2.0', :require => false
gem 'voxpupuli-acceptance', '~> 3.0', :require => false
end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false
gem 'voxpupuli-release', '~> 3.0', :require => false
gem 'faraday-retry', '~> 2.1', :require => false
gem 'voxpupuli-release', '~> 3.0', :require => false
end

gem 'rake', :require => false
Expand Down
101 changes: 57 additions & 44 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ Default value: `false`

##### <a name="-systemd--cache"></a>`cache`

Data type: `Variant[Boolean,Enum['no-negative']]`
Data type: `Optional[Variant[Boolean,Enum['no-negative']]]`

Takes a boolean argument or "no-negative".
Takes a boolean argument or "no-negative". If left `undef` the cache setting will not be modified.

Default value: `false`
Default value: `undef`

##### <a name="-systemd--dns_stub_listener"></a>`dns_stub_listener`

Expand Down Expand Up @@ -837,6 +837,18 @@ systemd::manage_dropin { 'maxloglevel.conf':
}
```

##### have a unit instance auto run before user-<uid>.service

```puppet
systemd::manage_dropin { 'user-aklog.conf':
unit => 'user@.service',
unit_entry => {
'After' => 'user-aklog@%i.service',
'Requires' => 'user-aklog@%i.service'
}
}
```

#### Parameters

The following parameters are available in the `systemd::manage_dropin` defined type:
Expand Down Expand Up @@ -2289,7 +2301,7 @@ custom datatype that validates different filenames for systemd units and unit te
* **See also**
* https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Alias of `Pattern[/^[a-zA-Z0-9:\-_.\\@]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/]`
Alias of `Pattern[/^[a-zA-Z0-9:\-_.\\@%]+\.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$/]`

### <a name="Systemd--Unit--Install"></a>`Systemd::Unit::Install`

Expand Down Expand Up @@ -2413,12 +2425,10 @@ Struct[{
Optional['DevicePolicy'] => Enum['auto','closed','strict'],
Optional['Slice'] => String[1],
Optional['Delegate'] => Boolean,
Optional['OOMScoreAdjust'] => Integer[-1000,1000],
Optional['RestartSec'] => String,
Optional['TimeoutStartSec'] => String,
Optional['TimeoutStopSec'] => String,
Optional['TimeoutAbortSec'] => String,
Optional['TimeoutAbortSec'] => String,
Optional['TimeoutSec'] => String,
Optional['TimeoutStartFailureMode'] => Enum['terminate', 'abort', 'kill'],
Optional['TimeoutStopFailureMode'] => Enum['terminate', 'abort', 'kill'],
Expand All @@ -2434,7 +2444,7 @@ Struct[{
Optional['NotifyAccess'] => Enum['none', 'default', 'main', 'exec', 'all'],
Optional['OOMPolicy'] => Enum['continue', 'stop','kill'],
Optional['OOMScoreAdjust'] => Integer[-1000,1000],
Optional['Environment'] => String,
Optional['Environment'] => Variant[String[0],Array[String[1],1]],
Optional['EnvironmentFile'] => Variant[
Stdlib::Unixpath,Pattern[/-\/.+/],
Array[Variant[Stdlib::Unixpath,Pattern[/-\/.+/]],1],
Expand Down Expand Up @@ -2597,44 +2607,47 @@ Alias of

```puppet
Struct[{
Optional['Description'] => Variant[String,Array[String,1]],
Optional['Documentation'] => Variant[String,Array[String,1]],
Optional['Wants'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Requires'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Requisite'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['BindsTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PartOf'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Upholds'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Conflicts'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Before'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['After'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['OnFailure'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['OnSuccess'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PropagatesReloadTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['ReloadPropagatedFrom'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PropagatesStopTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['StopPropagatedFrom'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['JoinsNamespaceOf'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['RequiresMountsFor'] => Variant[Enum[''],Stdlib::Unixpath,Array[Variant[Enum[''],Stdlib::Unixpath],1]],
Optional['OnSuccessJobMode'] => Enum['fail', 'replace', 'replace-irreversibly', 'isolate', 'flush', 'ignore-dependencies', 'ignore-requirements'],
Optional['OnFailureJobMode'] => Enum['fail', 'replace', 'replace-irreversibly', 'isolate', 'flush', 'ignore-dependencies', 'ignore-requirements'],
Optional['IgnoreOnIsolate'] => Boolean,
Optional['StopWhenUnneeded'] => Boolean,
Optional['RefuseManualStart'] => Boolean,
Optional['RefuseManualStop'] => Boolean,
Optional['AllowIsolate'] => Boolean,
Optional['DefaultDependencies'] => Boolean,
Optional['SurviveFinalKillSignal'] => Boolean,
Optional['CollectMode'] => Enum['inactive', 'inactive-or-failed'],
Optional['FailureAction'] => Enum['none', 'reboot', 'reboot-force', 'reboot-immediate', 'poweroff', 'poweroff-force', 'poweroff-immediate', 'exit', 'exit-force', 'soft-reboot', 'soft-reboot-force', 'kexec', 'kexec-force', 'halt', 'halt-force', 'halt-immediate'],
Optional['SuccessAction'] => Enum['none', 'reboot', 'reboot-force', 'reboot-immediate', 'poweroff', 'poweroff-force', 'poweroff-immediate', 'exit', 'exit-force', 'soft-reboot', 'soft-reboot-force', 'kexec', 'kexec-force', 'halt', 'halt-force', 'halt-immediate'],
Optional['FailureActionExitStatus'] => Variant[Enum[''],Integer[0, 255]],
Optional['SuccessActionExitStatus'] => Variant[Enum[''],Integer[0, 255]],
Optional['Description'] => Variant[String,Array[String,1]],
Optional['Documentation'] => Variant[String,Array[String,1]],
Optional['Wants'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Requires'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Requisite'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['BindsTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PartOf'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Upholds'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Conflicts'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['Before'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['After'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['OnFailure'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['OnSuccess'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PropagatesReloadTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['ReloadPropagatedFrom'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['PropagatesStopTo'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['StopPropagatedFrom'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['JoinsNamespaceOf'] => Variant[Enum[''],Systemd::Unit,Array[Variant[Enum[''],Systemd::Unit],1]],
Optional['RequiresMountsFor'] => Variant[Enum[''],Stdlib::Unixpath,Array[Variant[Enum[''],Stdlib::Unixpath],1]],
Optional['OnSuccessJobMode'] => Enum['fail', 'replace', 'replace-irreversibly', 'isolate', 'flush', 'ignore-dependencies', 'ignore-requirements'],
Optional['OnFailureJobMode'] => Enum['fail', 'replace', 'replace-irreversibly', 'isolate', 'flush', 'ignore-dependencies', 'ignore-requirements'],
Optional['IgnoreOnIsolate'] => Boolean,
Optional['StopWhenUnneeded'] => Boolean,
Optional['RefuseManualStart'] => Boolean,
Optional['RefuseManualStop'] => Boolean,
Optional['AllowIsolate'] => Boolean,
Optional['DefaultDependencies'] => Boolean,
Optional['SurviveFinalKillSignal'] => Boolean,
Optional['CollectMode'] => Enum['inactive', 'inactive-or-failed'],
Optional['FailureAction'] => Enum['none', 'reboot', 'reboot-force', 'reboot-immediate', 'poweroff', 'poweroff-force', 'poweroff-immediate', 'exit', 'exit-force', 'soft-reboot', 'soft-reboot-force', 'kexec', 'kexec-force', 'halt', 'halt-force', 'halt-immediate'],
Optional['SuccessAction'] => Enum['none', 'reboot', 'reboot-force', 'reboot-immediate', 'poweroff', 'poweroff-force', 'poweroff-immediate', 'exit', 'exit-force', 'soft-reboot', 'soft-reboot-force', 'kexec', 'kexec-force', 'halt', 'halt-force', 'halt-immediate'],
Optional['FailureActionExitStatus'] => Variant[Enum[''],Integer[0, 255]],
Optional['SuccessActionExitStatus'] => Variant[Enum[''],Integer[0, 255]],
# Conditions and Asserts
Optional['ConditionPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['ConditionPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['AssertPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['AssertPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['AssertPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['AssertPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['ConditionPathExists'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['ConditionPathIsDirectory'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['ConditionPathIsMountPoint'] => Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/],Array[Variant[Enum[''],Stdlib::Unixpath,Pattern[/^!.*$/]],1]],
Optional['StartLimitIntervalSec'] => String[1],
Optional['StartLimitBurst'] => Integer[1],
}]
```

4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# "opportunistic" and "false" (default) to "no".
#
# @param cache
# Takes a boolean argument or "no-negative".
# Takes a boolean argument or "no-negative". If left `undef` the cache setting will not be modified.
#
# @param dns_stub_listener
# Takes a boolean argument or one of "udp" and "tcp".
Expand Down Expand Up @@ -201,7 +201,7 @@
Optional[Variant[Boolean,Enum['resolve']]] $multicast_dns = undef,
Optional[Variant[Boolean,Enum['allow-downgrade']]] $dnssec = undef,
Variant[Boolean,Enum['yes', 'opportunistic', 'no']] $dnsovertls = false,
Variant[Boolean,Enum['no-negative']] $cache = false,
Optional[Variant[Boolean,Enum['no-negative']]] $cache = undef,
Optional[Variant[Boolean,Enum['udp','tcp']]] $dns_stub_listener = undef,
Optional[Array[String[1]]] $dns_stub_listener_extra = undef,
Boolean $manage_resolv_conf = true,
Expand Down
9 changes: 9 additions & 0 deletions manifests/manage_dropin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
# }
# }
#
# @example have a unit instance auto run before user-<uid>.service
# systemd::manage_dropin { 'user-aklog.conf':
# unit => 'user@.service',
# unit_entry => {
# 'After' => 'user-aklog@%i.service',
# 'Requires' => 'user-aklog@%i.service'
# }
# }
#
# @param unit The unit to create a dropfile for
# @param filename The target unit file to create. The filename of the drop in. The full path is determined using the path, unit and this filename.
# @param ensure The state of this dropin file
Expand Down
2 changes: 1 addition & 1 deletion manifests/resolved.pp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
default => $cache,
}

if $cache {
if $_cache {
ini_setting { 'cache':
ensure => 'present',
value => $_cache,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-systemd",
"version": "6.3.0",
"version": "6.4.0",
"author": "Vox Pupuli",
"summary": "Puppet Systemd module",
"license": "Apache-2.0",
Expand Down
19 changes: 19 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,25 @@
}
end

context 'when enabling resolved with false cache variant' do
let(:params) do
{
manage_resolved: true,
cache: false,
}
end

it { is_expected.to create_service('systemd-resolved').with_ensure('running') }
it { is_expected.to create_service('systemd-resolved').with_enable(true) }

it {
expect(subject).to contain_ini_setting('cache').with(
path: '/etc/systemd/resolved.conf',
value: 'no'
)
}
end

context 'with alternate target' do
let(:params) do
{
Expand Down
17 changes: 17 additions & 0 deletions spec/defines/manage_dropin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@
}
end

context 'with an instance to instance relation' do
let(:params) do
super().merge(
unit_entry: {
'After' => ['user-runtime-dir@%i.service'],
'Requires' => ['user-runtime-dir@%i.service'],
}
)
end

it {
is_expected.to contain_systemd__dropin_file('foobar.conf').
with_content(%r{^After=user-runtime-dir@%i.service$}).
with_content(%r{^Requires=user-runtime-dir@%i.service$})
}
end

context 'with a timer entry' do
let(:params) do
super().merge(
Expand Down
3 changes: 3 additions & 0 deletions spec/defines/manage_unit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Type: 'oneshot',
ExecStart: '/usr/bin/doit.sh',
SyslogIdentifier: 'doit-backwards.sh',
Environment: ['bla=foo', 'foo=bla']
},
install_entry: {
WantedBy: 'multi-user.target',
Expand All @@ -36,6 +37,8 @@
with_content(%r{^DefaultDependencies=true$}).
with_content(%r{^\[Service\]$}).
with_content(%r{^SyslogIdentifier=doit-backwards\.sh$}).
with_content(%r{^Environment=bla=foo$}).
with_content(%r{^Environment=foo=bla$}).
with_content(%r{^\[Install\]$}).
with_content(%r{^Description=My great service$}).
with_content(%r{^Description=has two lines of description$}).
Expand Down
3 changes: 3 additions & 0 deletions spec/type_aliases/systemd_unit_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
it { is_expected.to allow_value({ 'ExecStart' => 'notabsolute.sh' }) }
it { is_expected.not_to allow_value({ 'ExecStart' => '*/wrongprefix.sh' }) }

it { is_expected.to allow_value({ 'Environment' => '' }) }
it { is_expected.to allow_value({ 'Environment' => 'FOO=BAR' }) }
it { is_expected.to allow_value({ 'Environment' => ['FOO=BAR', 'BAR=FOO'] }) }
it { is_expected.to allow_value({ 'EnvironmentFile' => '/etc/sysconfig/foo' }) }
it { is_expected.to allow_value({ 'EnvironmentFile' => '-/etc/sysconfig/foo' }) }
it { is_expected.to allow_value({ 'EnvironmentFile' => ['/etc/sysconfig/foo', '-/etc/sysconfig/foo-bar'] }) }
Expand Down
Loading