Closed TheMeier closed 2 months ago
The fear is that since undef is the default this is now an action.
It's probably okay with this parameter.
I always quite like yumrepo's explicit absent
.
The fear is that since undef is the default this is now an action.
It's probably okay with this parameter.
I always quite like yumrepo's explicit
absent
.
I see you point. I can't follow your comparison to yumrepo here. These are class parameters, yumrepo is more There is a couple of ways we could handle this:
implement more logic with a custom function that could look something like this:
$_dns_stub_listener = $dns_stub_listener ? {
true => 'yes',
false => 'no',
default => $dns_stub_listener,
}
if ($_dns_stub_listener) {
ini_setting { 'dns_stub_listener':
ensure => new_function($_dns_stub_listener),
value => $_dns_stub_listener,
setting => 'DNSStubListener',
section => 'Resolve',
path => '/etc/systemd/resolved.conf',
notify => Service['systemd-resolved'],
}
}
if $manage_* {
contain systemd::*
}
and change alle the subclasses marked @api private
to be used directly by the user.
This would have 2 benefits, less params in init.pp
, move many test out of init_spec.rb
That would be a drastic change, though. But I think it is worth considering.
Not sure about the custom function. Isn't it just:
if $dns_stub_listener =~ NotUndef { ini_setting { '': ensure => 'present', value => $_dns_stub_listener, setting => 'DNSStubListener', section => 'Resolve', path => '/etc/systemd/resolved.conf', notify => Service['systemd-resolved'], } }
i.e default remains as do nothing and set if set to which ever ?
But wasn't the whole point to find a way to set ensure => 'absent'
. The idea was that one can set $dns_stub_listener == 'absent'
and only in that case the ensure would be set to absent
@traylenator I have changed the code for an alternative solution... please have another look
The commit message and PR description no longer match the actual code. Would you mind fixing that up to avoid confusion in the future?
Pull Request (PR) description
When
dns_stub_listener
anddns_stub_listener_extra
are changed from a value toundef
they don't get removed from the config.There is plenty more settings here that could use the same treatment I guess
This Pull Request (PR) fixes the following issues
Fixes #397