voxpupuli / puppet-systemd

Puppet module to manage systemd
https://forge.puppet.com/puppet/systemd
Apache License 2.0
52 stars 142 forks source link

remove resolved settings from config when changed to `absent` #429

Closed TheMeier closed 2 months ago

TheMeier commented 4 months ago

Pull Request (PR) description

When dns_stub_listener and dns_stub_listener_extra are changed from a value to undef 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

traylenator commented 4 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.

TheMeier commented 4 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.

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:

TheMeier commented 4 months ago

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

TheMeier commented 4 months ago

@traylenator I have changed the code for an alternative solution... please have another look

ekohl commented 3 months ago

The commit message and PR description no longer match the actual code. Would you mind fixing that up to avoid confusion in the future?