From e8541a7bff4bfa45fefbb841107cd12d774f86bf Mon Sep 17 00:00:00 2001
From: Georg Lukas <georg@op-co.de>
Date: Tue, 31 Mar 2009 02:30:09 +0200
Subject: changed config requirements and help

---
 src/config.cc |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/config.cc b/src/config.cc
index 137d1dc851e10113a56360dc75c90138b3b0f762..9760bb40ede7f80048acbad04b6b357bd1add8a5 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -60,26 +60,36 @@ void Config::requestCreator(void *data, WriteMarshalStream* msOut)
 }
 
 static const char *config_cmd_usage =
-    "config [node1,node2,...] <module>.<variable> <value>  \n"
-    " with <nodeN>		hostname	or\n"
-		" with [..]				for all nodes in network\n"
-    " with <module>		the module containing the configuration variable\n"
-    " with <value>		the value to be assigned to the variable\n";
+    "rc [<nodelist>|..] [<variable> [<value>]]\n"
+    "print or set local or remote configuration:\n"
+    "	<nodelist>	comma separated hostname list '..' for all nodes\n"
+    "			default: local node only\n"
+    "	<variable>	config variable to be queried/set. default: list all\n"
+    "	<value>		the value to be assigned to the variable\n";
 
 int Config::init() {
 
     REP_MAP_OBJ(Shell *, shell);
-    REP_MAP_OBJ(SppManager *, sppman);
+    REP_MAP_OBJ(SppManager *, sppManager);
 
-    if (!shell || !sppman)
+    /* either shell or SPP must be present for config to make sense */
+    if (!shell && !sppManager)
 	return -1;
 
-    shell->add_command("rc", remoteconfig_command_fn, this,
-		       "remote manipulation of all configurations",
-		       config_cmd_usage);
+    if (shell) {
+	    shell->add_command("rc", remoteconfig_command_fn, this,
+			       "remote configuration",
+			       config_cmd_usage);
+    } else {
+	    GEA.dbg() << "Config is missing shell. no local configuration possible!" << std::endl;
+    }
 
+    if (sppManager) {
+	    sppManager->registerHandler(SPP_CONFIG_ID, 0, Config::requestHandler);
+    } else {
+	    GEA.dbg() << "Config is missing SPPManager. no remote configuration possible!" << std::endl;
+    }
 
-    sppman->registerHandler(SPP_CONFIG_ID, 0, Config::requestHandler);
     return 0;
 }
 
-- 
1.6.2.1


