Diff

core/modulemanager.lua @ 3598:48ebea937260

modulemanager: Return an error when loading a module on a non-existent host, don't create the host. Removes dependecy on componentmanager.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 10 Nov 2010 20:14:33 +0500
parent 3596:bbeba9f2acf8
child 3608:ae0f83feaff4
line wrap: on
line diff
--- a/core/modulemanager.lua	Wed Nov 10 19:57:35 2010 +0500
+++ b/core/modulemanager.lua	Wed Nov 10 20:14:33 2010 +0500
@@ -91,6 +91,8 @@
 function load(host, module_name, config)
 	if not (host and module_name) then
 		return nil, "insufficient-parameters";
+	elseif not hosts[host] then
+		return nil, "unknown-host";
 	end
 	
 	if not modulemap[host] then
@@ -118,11 +120,6 @@
 	api_instance.environment = pluginenv;
 	
 	setfenv(mod, pluginenv);
-	if not hosts[host] then
-		local create_component = _G.require "core.componentmanager".create_component;
-		hosts[host] = create_component(host);
-		log("debug", "Created new component: %s", host);
-	end
 	hosts[host].modules = modulemap[host];
 	modulemap[host][module_name] = pluginenv;