Skip to content

Commit

Permalink
remove resovled settings from config when changed to undef
Browse files Browse the repository at this point in the history
fixes #397
  • Loading branch information
TheMeier committed Mar 11, 2024
1 parent 51c0d2c commit 8e4dead
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
10 changes: 5 additions & 5 deletions manifests/resolved.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
Optional[Variant[Boolean,Enum['allow-downgrade']]] $dnssec = $systemd::dnssec,
Optional[Variant[Boolean,Enum['yes', 'opportunistic', 'no']]] $dnsovertls = $systemd::dnsovertls,
Optional[Variant[Boolean,Enum['no-negative']]] $cache = $systemd::cache,
Optional[Variant[Boolean,Enum['udp', 'tcp']]] $dns_stub_listener = $systemd::dns_stub_listener,
Optional[Variant[Boolean,Enum['udp', 'tcp','absent']]] $dns_stub_listener = $systemd::dns_stub_listener,
Optional[Array[String[1]]] $dns_stub_listener_extra = $systemd::dns_stub_listener_extra,
Boolean $use_stub_resolver = $systemd::use_stub_resolver,
) {
Expand Down Expand Up @@ -239,9 +239,9 @@
default => $dns_stub_listener,
}

if $_dns_stub_listener {
if $dns_stub_listener =~ String[1] {
ini_setting { 'dns_stub_listener':
ensure => 'present',
ensure => stdlib::ensure($dns_stub_listener != 'absent'),
value => $_dns_stub_listener,
setting => 'DNSStubListener',
section => 'Resolve',
Expand All @@ -250,9 +250,9 @@
}
}

if $dns_stub_listener_extra {
if $dns_stub_listener_extra =~ NotUndef {
ini_setting { 'dns_stub_listener_extra':
ensure => 'present',
ensure => stdlib::ensure($dns_stub_listener_extra != 'absent'),
value => $dns_stub_listener_extra,
setting => 'DNSStubListenerExtra',
section => 'Resolve',
Expand Down
13 changes: 9 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
it { is_expected.not_to contain_ini_setting('dnssec') }
it { is_expected.not_to contain_ini_setting('dnsovertls') }
it { is_expected.not_to contain_ini_setting('cache') }
it { is_expected.not_to contain_ini_setting('dns_stub_listener') }
it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') }

Check failure on line 115 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

systemd supported operating systems on redhat-8-x86_64 when enabling resolved with DNS values (string) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 115 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on virtuozzolinux-7-x86_64 when enabling resolved with DNS values (string) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 115 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on gentoo-2-x86_64 when enabling resolved with DNS values (string) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 115 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on almalinux-8-x86_64 when enabling resolved with DNS values (string) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 115 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on almalinux-9-x86_64 when enabling resolved with DNS values (string) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]
end

context 'when enabling resolved with DNS values (array)' do
Expand All @@ -134,7 +134,7 @@
it { is_expected.not_to contain_ini_setting('dnssec') }
it { is_expected.not_to contain_ini_setting('dnsovertls') }
it { is_expected.not_to contain_ini_setting('cache') }
it { is_expected.not_to contain_ini_setting('dns_stub_listener') }
it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') }

Check failure on line 137 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

systemd supported operating systems on redhat-8-x86_64 when enabling resolved with DNS values (array) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 137 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on virtuozzolinux-7-x86_64 when enabling resolved with DNS values (array) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 137 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on gentoo-2-x86_64 when enabling resolved with DNS values (array) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 137 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on almalinux-8-x86_64 when enabling resolved with DNS values (array) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]

Check failure on line 137 in spec/classes/init_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

systemd supported operating systems on almalinux-9-x86_64 when enabling resolved with DNS values (array) is expected to contain Ini_setting[dns_stub_listener] with ensure => "absent" Failure/Error: it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('absent') } expected that the catalogue would contain Ini_setting[dns_stub_listener]
end

context 'when enabling resolved with DNS values (full)' do
Expand Down Expand Up @@ -171,8 +171,13 @@
)
}

it { is_expected.to contain_ini_setting('dns_stub_listener') }
it { is_expected.to contain_ini_setting('dns_stub_listener_extra').with_value(['192.0.2.1', '2001:db8::1']) }
it { is_expected.to contain_ini_setting('dns_stub_listener').with_ensure('present') }

it {
is_expected.to contain_ini_setting('dns_stub_listener_extra').
with_value(['192.0.2.1', '2001:db8::1']).
with_ensure('present')
}
end

context 'when enabling resolved with no-negative cache variant' do
Expand Down

0 comments on commit 8e4dead

Please sign in to comment.