voxpupuli / puppet-augeasproviders_sysctl

Augeas-based sysctl type and provider for Puppet
Apache License 2.0
10 stars 36 forks source link

Remove of entries fails, if more than one target file is used #96

Open Tuxdiver opened 1 week ago

Tuxdiver commented 1 week ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Do some settings with different targets:

  sysctl{'net.ipv6.conf.all.disable_ipv6': ensure => present, value => 1, target => '/etc/sysctl.d/99-disable-ipv6.conf' }
  sysctl{'net.ipv4.tcp_syncookies':         ensure => present, value => 2, target => '/etc/sysctl.d/99-ddos-abwehr.conf'}

and apply them. Both files are created and the entries are added.

Then try to remove the second setting:

  sysctl{'net.ipv6.conf.all.disable_ipv6': ensure => present, value => 1, target => '/etc/sysctl.d/99-disable-ipv6.conf' }
  sysctl{'net.ipv4.tcp_syncookies':          ensure => absent, value => 2, target => '/etc/sysctl.d/99-ddos-abwehr.conf'}

and the apply will do nothing

If I remove the first entry (net.ipv6.conf.all.disable_ipv6) from the manifest or move the second entry to the top, it works.

What are you seeing

Puppet does not remove the second setting

What behaviour did you expect instead

Puppet should remove the second setting when ensure=>absent is active.

Output log

Nothing

Any additional information you'd like to impart

The module seems to support only one target file if you want to remove an entry. Changing values or adding entries works, regardless of the number of targets.