hostmanager: Log an error if no hosts are defined

Fri, 12 Feb 2010 12:43:50 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 12 Feb 2010 12:43:50 +0000
changeset 2617
0888bb4e817d
parent 2616
58148ad08af5
child 2618
b8f6aa70d019

hostmanager: Log an error if no hosts are defined

core/hostmanager.lua file | annotate | diff | comparison | revisions
--- a/core/hostmanager.lua	Fri Feb 12 12:29:53 2010 +0000
+++ b/core/hostmanager.lua	Fri Feb 12 12:43:50 2010 +0000
@@ -32,12 +32,19 @@
 
 local function load_enabled_hosts(config)
 	local defined_hosts = config or configmanager.getconfig();
+	local activated_any_host;
 	
 	for host, host_config in pairs(defined_hosts) do
 		if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then
+			activated_any_host = true;
 			activate(host, host_config);
 		end
 	end
+	
+	if not activated_any_host then
+		log("error", "No hosts defined in the config file. This may cause unexpected behaviour as no modules will be loaded.");
+	end
+	
 	eventmanager.fire_event("hosts-activated", defined_hosts);
 	hosts_loaded_once = true;
 end

mercurial