aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-01-09 16:08:15 +0100
committerKim Alvefur <zash@zash.se>2022-01-09 16:08:15 +0100
commitb21bc2b374353ca562d95dfd574fed59206312b3 (patch)
tree002d2a47bc0b1c944278a2773adb44c06c0d20d3 /tools
parent07c3f35ab8e11f758298706b6a1f6f85dcc7092c (diff)
downloadprosody-b21bc2b374353ca562d95dfd574fed59206312b3.tar.gz
prosody-b21bc2b374353ca562d95dfd574fed59206312b3.zip
migrator: Add option to keep going despite errors
Diffstat (limited to 'tools')
-rw-r--r--tools/migration/prosody-migrator.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua
index e50fcc76..57d87e20 100644
--- a/tools/migration/prosody-migrator.lua
+++ b/tools/migration/prosody-migrator.lua
@@ -37,6 +37,7 @@ local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua";
local function usage()
print("Usage: " .. arg[0] .. " [OPTIONS] FROM_STORE TO_STORE");
print(" --config FILE Specify config file")
+ print(" --keep-going Keep going in case of errors");
print(" -v, --verbose Incease log-level");
print("");
print("If no stores are specified, 'input' and 'output' are used.");
@@ -183,6 +184,19 @@ local migrate_once = {
end;
}
+if options["keep-going"] then
+ local xpcall = require "util.xpcall".xpcall;
+ local function log_err(err)
+ log("error", "Error migrating data: %s", err);
+ log("debug", "%s", debug.traceback());
+ end
+ for t, f in pairs(migrate_once) do
+ migrate_once[t] = function (origin, destination, user)
+ xpcall(f, log_err, origin, destination, user);
+ end
+ end
+end
+
local migration_runner = async.runner(function (job)
for host, stores in pairs(job.input.hosts) do
prosody.hosts[host] = startup.make_host(host);