plugins/mod_admin_telnet.lua
changeset 9335 048389a9bbd4
parent 9333 36badabc85ce
child 9394 4001eb3f465a
equal deleted inserted replaced
9334:2f634cc02eac 9335:048389a9bbd4
   402 		end
   402 		end
   403 	end
   403 	end
   404 	return ok, (ok and "Module unloaded from "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err));
   404 	return ok, (ok and "Module unloaded from "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err));
   405 end
   405 end
   406 
   406 
       
   407 local function _sort_hosts(a, b)
       
   408 	if a == "*" then return true
       
   409 	elseif b == "*" then return false
       
   410 	else return a < b; end
       
   411 end
       
   412 
   407 function def_env.module:reload(name, hosts)
   413 function def_env.module:reload(name, hosts)
   408 	hosts = array.collect(get_hosts_set(hosts, name)):sort(function (a, b)
   414 	hosts = array.collect(get_hosts_set(hosts, name)):sort(_sort_hosts)
   409 		if a == "*" then return true
       
   410 		elseif b == "*" then return false
       
   411 		else return a < b; end
       
   412 	end);
       
   413 
   415 
   414 	-- Reload the module for each host
   416 	-- Reload the module for each host
   415 	local ok, err, count = true, nil, 0;
   417 	local ok, err, count = true, nil, 0;
   416 	for _, host in ipairs(hosts) do
   418 	for _, host in ipairs(hosts) do
   417 		if modulemanager.is_loaded(host, name) then
   419 		if modulemanager.is_loaded(host, name) then