luci-app-statistics: fix collectd config generation 2844/head
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 9 Jul 2019 10:47:37 +0000 (12:47 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Tue, 9 Jul 2019 11:04:06 +0000 (13:04 +0200)
Fix config generation for the following sections:

* curl
* exec
* network
* iptables

Ref: https://github.com/openwrt/packages/issues/9427
Fixes: c1380ab ("make luci-app-statistics more extensible")
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-statistics/root/usr/bin/stat-genconfig

index df36da419fc3b55d515f0e965278a7eacf2da17f..0c49b1f953b6aa59789072e9af2c99e4949abdc6 100755 (executable)
@@ -276,15 +276,11 @@ plugins = {
                { },
                { }
        },
-       curl = config_curl,
-       exec    = config_exec,
-       iptables = config_iptables,
        logfile = {
                { "LogLevel", "File" },
                { "Timestamp" },
                { }
        },
-       network = config_network,
 }
 
 local plugin_dir = "/usr/lib/lua/luci/statistics/plugins/"
@@ -293,7 +289,17 @@ for filename in nixio.fs.dir(plugin_dir) do
        setfenv(plugin_fun, { _ = luci.i18n.translate })
        local plugin = plugin_fun()
        local name = filename:gsub("%.lua", "")
-       plugins[name] = plugin.legend
+       if (name == "exec") then
+               plugins[name] = config_exec
+       elseif (name == "iptables") then
+               plugins[name] = config_iptables
+       elseif (name == "curl") then
+               plugins[name] = config_curl
+       elseif (name == "network") then
+               plugins[name] = config_network
+       else
+               plugins[name] = plugin.legend
+       end
 end