diff options
| author | Jo-Philipp Wich <jo@mein.io> | 2022-04-25 20:55:02 +0200 |
|---|---|---|
| committer | Jo-Philipp Wich <jo@mein.io> | 2022-04-25 21:00:48 +0200 |
| commit | 712bc8e52d73720dc42577c08eb80ce7b1548b1e (patch) | |
| tree | a455f60764621574077b388c1edd4298141a9d6f | |
| parent | 786ebc9c014efed4df0d67b140b2348a58d99f5b (diff) | |
luci-app-statistics: stat-genconfig: don't emit bools for absent uci options
Do not emit native collectd.conf boolean false options if the corresponding
uci option is unset in order to honour collectd's implicit defaults.
This fixes certain options, such as the memory plugins `ValuesAbsolute`,
being without effect if declared as default-enabled in the related plugin
uci forms.
Fixes: #5777
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f16037cec5e3f65cffe2f5788c264f1912435b0e)
| -rwxr-xr-x | applications/luci-app-statistics/root/usr/bin/stat-genconfig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig index 82431fbd39..24a2ca0e01 100755 --- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig @@ -238,13 +238,13 @@ function _bool( s, n, nopad ) local pad = "" if not nopad then pad = "\t" end - if s and s == "1" then - str = pad .. n .. " true" - else - str = pad .. n .. " false" + if s == "1" then + str = pad .. n .. " true\n" + elseif s == "0" then + str = pad .. n .. " false\n" end - return str .. "\n" + return str end function _string( s, n, nopad ) |
