aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/configwizard.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-25 14:22:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-25 14:22:20 +0100
commite55b2d55dd4beffc4aa9a935da419b51bab3dbbe (patch)
treeb1ec917a009bd31fdca5e4d4704429d75b59bd78 /lualib/rspamadm/configwizard.lua
parent55fd8637509981e691f1163948b1b2c472aba2d6 (diff)
downloadrspamd-e55b2d55dd4beffc4aa9a935da419b51bab3dbbe.tar.gz
rspamd-e55b2d55dd4beffc4aa9a935da419b51bab3dbbe.zip
[Minor] Fix configwizard behaviour when DB is empty
Diffstat (limited to 'lualib/rspamadm/configwizard.lua')
-rw-r--r--lualib/rspamadm/configwizard.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua
index fb4caf20c..a4bccd7ab 100644
--- a/lualib/rspamadm/configwizard.lua
+++ b/lualib/rspamadm/configwizard.lua
@@ -395,6 +395,13 @@ local function check_redis_classifier(cls, changes)
end
local function get_version(conn)
+ conn:add_cmd("SMEMBERS", {"RS_keys"})
+
+ local ret,members = conn:exec()
+
+ -- Empty db
+ if not ret or #members == 0 then return false,0 end
+
-- We still need to check versions
local lua_script = [[
local ver = 0
@@ -469,8 +476,8 @@ return ttl
local r,ver = get_version(conn)
if not r then return false end
if ver ~= 2 then
- printf("You have configured new schema for %s/%s but your DB has old data",
- symbol_spam, symbol_ham)
+ printf("You have configured new schema for %s/%s but your DB has old version: %s",
+ symbol_spam, symbol_ham, ver)
try_convert(false)
else
printf("You have configured new schema for %s/%s and your DB already has new layout (v. %s). DB conversion is not needed.",