diff options
author | Kim Alvefur <zash@zash.se> | 2024-11-15 15:52:37 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-11-15 15:52:37 +0100 |
commit | 7b8f6e3c3e8be2470787408cc61d1919bbac0c4b (patch) | |
tree | 2fea94609eb1bf9f3b9645c0b5d1aadd026ca720 | |
parent | 53edd95324ac945caf39d549addcb906c9f97690 (diff) | |
download | prosody-7b8f6e3c3e8be2470787408cc61d1919bbac0c4b.tar.gz prosody-7b8f6e3c3e8be2470787408cc61d1919bbac0c4b.zip |
mod_admin_shell: Report when a module is already loaded
Hopefully less confusing than "Module loaded onto 0 hosts"
-rw-r--r-- | plugins/mod_admin_shell.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 02f7c559..0b8d3c43 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -631,6 +631,7 @@ describe_command [[module:load(module, host) - Load the specified module on the function def_env.module:load(name, hosts) hosts = get_hosts_with_module(hosts); + local already_loaded = set.new(); -- Load the module for each host local ok, err, count, mod = true, nil, 0; for host in hosts do @@ -655,12 +656,17 @@ function def_env.module:load(name, hosts) self.session.print("Note: Module will not be loaded after restart unless enabled in configuration"); end end + else + already_loaded:add(host); end end if not ok then return ok, "Last error: "..tostring(err); end + if already_loaded == hosts then + return ok, "Module already loaded"; + end return ok, "Module loaded onto "..count.." host"..(count ~= 1 and "s" or ""); end |