Comparison

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
comparison
equal deleted inserted replaced
8247:2c386ee5cd5c 8248:259e0010a6d4
937 show_warning("The directory "..cert_basedir.." not only writable by its owner"); 937 show_warning("The directory "..cert_basedir.." not only writable by its owner");
938 return 1; 938 return 1;
939 end 939 end
940 local subcmd = table.remove(arg, 1); 940 local subcmd = table.remove(arg, 1);
941 if type(cert_commands[subcmd]) == "function" then 941 if type(cert_commands[subcmd]) == "function" then
942 if not arg[1] then 942 if subcmd ~= "import" then -- hostnames are optional for import
943 show_message"You need to supply at least one hostname" 943 if not arg[1] then
944 arg = { "--help" }; 944 show_message"You need to supply at least one hostname"
945 end 945 arg = { "--help" };
946 if arg[1] ~= "--help" and not hosts[arg[1]] then 946 end
947 show_message(error_messages["no-such-host"]); 947 if arg[1] ~= "--help" and not hosts[arg[1]] then
948 return 1; 948 show_message(error_messages["no-such-host"]);
949 return 1;
950 end
949 end 951 end
950 return cert_commands[subcmd](arg); 952 return cert_commands[subcmd](arg);
951 elseif subcmd == "check" then 953 elseif subcmd == "check" then
952 return commands.check({"certs"}); 954 return commands.check({"certs"});
953 end 955 end