Comparison

core/modulemanager.lua @ 4638:352cd61e2682

modulemanager: Allow loading a module onto "*" (part-fixes #228)
author Matthew Wild <mwild1@gmail.com>
date Sat, 21 Apr 2012 20:00:30 +0100
parent 4606:17785dbd9d58
child 4639:98a29138dec8
comparison
equal deleted inserted replaced
4637:1f6c6c678f96 4638:352cd61e2682
115 end 115 end
116 116
117 local function do_load_module(host, module_name) 117 local function do_load_module(host, module_name)
118 if not (host and module_name) then 118 if not (host and module_name) then
119 return nil, "insufficient-parameters"; 119 return nil, "insufficient-parameters";
120 elseif not hosts[host] then 120 elseif not hosts[host] and host ~= "*"then
121 return nil, "unknown-host"; 121 return nil, "unknown-host";
122 end 122 end
123 123
124 if not modulemap[host] then 124 if not modulemap[host] then
125 modulemap[host] = {}; 125 modulemap[host] = {};
126 hosts[host].modules = modulemap[host]; 126 if host ~= "*" then
127 hosts[host].modules = modulemap[host];
128 end
127 end 129 end
128 130
129 if modulemap[host][module_name] then 131 if modulemap[host][module_name] then
130 log("warn", "%s is already loaded for %s, so not loading again", module_name, host); 132 log("warn", "%s is already loaded for %s, so not loading again", module_name, host);
131 return nil, "module-already-loaded"; 133 return nil, "module-already-loaded";