Changeset

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
parents 3597:8090880f0e18
children 3599:adc0b4df6fdd
files core/modulemanager.lua
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
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;