]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/predict: don't skip reconfiguration if nil is passed
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 14 Jan 2019 15:44:56 +0000 (16:44 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 14 Jan 2019 15:44:56 +0000 (16:44 +0100)
If you didn't specify any configuration (i.e. nil), the stats module
wouldn't get loaded even though the defaults need it to work.
Now we don't skip that part and pass whole .config() even on nil config.

NEWS
modules/predict/predict.lua
modules/predict/tests/predict.test.lua

diff --git a/NEWS b/NEWS
index d54bb03bac9294f44583b9c42e0582fe2454403a..823b5ea894dbce7307f9294a0bc774f05ccdb430 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Knot Resolver 3.x.y (2019-0m-dd)
+================================
+
+Bugfixes
+--------
+- predict module: load stats module if config didn't specify period (!755)
+
+
 Knot Resolver 3.2.1 (2019-01-10)
 ================================
 
index 846d4ef7d53867f64e364d66631d393938fcbd51..470700f3b2a3bc59421a01d691a46f19e35bc9c0 100644 (file)
@@ -158,7 +158,10 @@ end
 
 function predict.config(config)
        -- Reconfigure
-       if type(config) ~= 'table' then return end
+       config = config or {}
+       if type(config) ~= 'table' then
+               error('[predict] configuration must be a table or nil')
+       end
        if config.window then predict.window = config.window end
        if config.period then predict.period = config.period end
        -- Load dependent modules
index 10431045e60d4c4bfef37a83e9dc1fb8c6024b6e..3d7c7f7d24e3916f22a693aea22d2ab0b04f72be 100644 (file)
@@ -1,5 +1,5 @@
 -- setup resolver
-modules = { 'predict', 'stats' }
+modules = { 'predict' }
 
 -- mock global functions
 local resolve_count = 0