Skip to content

Commit

Permalink
Merge pull request #403 from traylenator/cacheparam
Browse files Browse the repository at this point in the history
systemd::cache = false result was vague.
  • Loading branch information
ekohl authored Dec 22, 2023
2 parents b36acbb + 549e16b commit 00915e3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
6 changes: 3 additions & 3 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
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
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
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

0 comments on commit 00915e3

Please sign in to comment.