Software /
code /
prosody
Diff
plugins/mod_admin_shell.lua @ 13562:f77c247258cc
mod_admin_shell: Report when a module is already loaded
Hopefully less confusing than "Module loaded onto 0 hosts"
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 15 Nov 2024 15:52:37 +0100 |
parent | 13561:d8f7a8a26965 |
child | 13582:67c9fc643873 |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Fri Nov 15 15:48:07 2024 +0100 +++ b/plugins/mod_admin_shell.lua Fri Nov 15 15:52:37 2024 +0100 @@ -631,6 +631,7 @@ 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 @@ 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