mod_migrate: Check that the hostname is known, or yell and abort (thanks Link Mauve)

Sun, 27 Mar 2016 20:09:29 +0200

author
Kim Alvefur <zash@zash.se>
date
Sun, 27 Mar 2016 20:09:29 +0200
changeset 2139
17408ddd34b0
parent 2138
d3231a4d6a60
child 2140
3a94b3cd31e2

mod_migrate: Check that the hostname is known, or yell and abort (thanks Link Mauve)

mod_migrate/mod_migrate.lua file | annotate | diff | comparison | revisions
--- a/mod_migrate/mod_migrate.lua	Sat Mar 26 23:25:07 2016 +0100
+++ b/mod_migrate/mod_migrate.lua	Sun Mar 27 20:09:29 2016 +0200
@@ -9,6 +9,9 @@
 	if not migrate_to then
 		return print("Usage: prosodyctl mod_migrate example.com <source-store>[-<store-type>] <target-driver> [users]*");
 	end
+	if not prosody.hosts[host] then
+		return print(("The host %q is not know by Prosody."):format(host));
+	end
 	sm.initialize_host(host);
 	um.initialize_host(host);
 	local module = module:context(host);

mercurial