voxpupuli / puppet-augeasproviders_sysctl

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

Persisting a sysctl that does not exist yet #49

Open zenitraM opened 3 years ago

zenitraM commented 3 years ago

Hi! :wave: I want to persist a sysctl that does not exist on the running system. This is because I want it to be enabled on next reboot before a kernel upgrade, so it gets enabled at boot before a subsequent Puppet run.

This would be something that, reading the docs, I thought would be doable using:

sysctl { "non_existing_sysctl":
  ensure  => present,
  value   => "1",
  apply   => false,
  persist => true,
}

However, if the sysctl does not exist, it currently fails (as it checks for its presence from the list obtained by sysctl -a), and if the :silent=>true parameter is set, it just adds the comment, not the actual value.

Would this be a behavior that would make sense adding to the module?. I see there is some support implemented for non-existent sysctls already for absent but not for present.

raphink commented 3 years ago

I think that could be interesting. You'll have to bypass the prefetch mechanism though.