duritong/puppet-sysctl — pull request #19 by ojacobson (2013-09-16 19:40:02+00:00)
Title: Major sysctl::value rewrite.

Bugs fixed:

* On linux, `sysctl::value` edited `/etc/sysctl.conf`, then skipped running `sysctl` if the edit succeeded (which it nearly always did). This is fixed; the `exec` resource for `sysctl` now checks whether the sysctl setting is actually set to the desired value by calling `sysctl -n KEY`.

This looks reasonably portable between at least Linux, OS X, FreeBSD, and OpenBSD, since all of them support `sysctl -n KEY` for obtaining current values without names.

* `sysctl::value` formerly used `grep` to parse sysctl config files and output. This lead to a number of edge cases, since `.` is a regexp metacharacter for grep, and since the output format of sysctl is not well-standardised with respect to whitespace. Using `sysctl -n` and `test` to examine the current state is more resilient to odd sysctl settings.

* I've removed the `suppress` option entirely, as it only worked on Linux and could only be used to mask bugs. If you are setting nonexistant sysctl values, stop doing that.

* I've generally improved this module's shell hygiene by using `shellquote` pervasively. This isn't perfect, and I suspect there are inputs that cause the `$unless` test to produce bogus commands, but it's generally a lot less likely to go wrong when faced with `$value`s containing quotes or whitespace.