Changeset

4645:4539e99be743

mod_admin_telnet: module:reload(): If module is loaded on *, reload it there first (ensuring shared module code is reloaded before per-host children of that module)
author Matthew Wild <mwild1@gmail.com>
date Sat, 21 Apr 2012 20:39:21 +0100
parents 4644:fb067c8a8d2e
children 4646:e0bd8587f2fb
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sat Apr 21 20:38:27 2012 +0100
+++ b/plugins/mod_admin_telnet.lua	Sat Apr 21 20:39:21 2012 +0100
@@ -334,11 +334,15 @@
 function def_env.module:reload(name, hosts)
 	local mm = require "modulemanager";
 
-	hosts = get_hosts_set(hosts, name);
-	
+	hosts = array.collect(get_hosts_set(hosts, name)):sort(function (a, b)
+		if a == "*" then return true
+		elseif b == "*" then return false
+		else return a < b; end
+	end);
+
 	-- Reload the module for each host
 	local ok, err, count = true, nil, 0;
-	for host in hosts do
+	for _, host in ipairs(hosts) do
 		if mm.is_loaded(host, name) then
 			ok, err = mm.reload(host, name);
 			if not ok then