# HG changeset patch # User Kim Alvefur # Date 1731682357 -3600 # Node ID f77c247258cc6a941b779cfe869c9eb142eb5e80 # Parent d8f7a8a2696591faffee67ea6f6756a6023d48d0 mod_admin_shell: Report when a module is already loaded Hopefully less confusing than "Module loaded onto 0 hosts" diff -r d8f7a8a26965 -r f77c247258cc plugins/mod_admin_shell.lua --- 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