Diff

prosodyctl @ 8248:259e0010a6d4

prosodyctl: Only demand a hostname argument to cert commands other than import
author Kim Alvefur <zash@zash.se>
date Mon, 18 Sep 2017 17:08:31 +0200
parent 8247:2c386ee5cd5c
child 8249:cc664a3917e2
line wrap: on
line diff
--- a/prosodyctl	Mon Sep 18 17:06:35 2017 +0200
+++ b/prosodyctl	Mon Sep 18 17:08:31 2017 +0200
@@ -939,13 +939,15 @@
 		end
 		local subcmd = table.remove(arg, 1);
 		if type(cert_commands[subcmd]) == "function" then
-			if not arg[1] then
-				show_message"You need to supply at least one hostname"
-				arg = { "--help" };
-			end
-			if arg[1] ~= "--help" and not hosts[arg[1]] then
-				show_message(error_messages["no-such-host"]);
-				return 1;
+			if subcmd ~= "import" then -- hostnames are optional for import
+				if not arg[1] then
+					show_message"You need to supply at least one hostname"
+					arg = { "--help" };
+				end
+				if arg[1] ~= "--help" and not hosts[arg[1]] then
+					show_message(error_messages["no-such-host"]);
+					return 1;
+				end
 			end
 			return cert_commands[subcmd](arg);
 		elseif subcmd == "check" then