[svn] commit: r318 - in /branches/jelte-datadef: configure.ac src/bin/bigtool/run_bigtool.py src/bin/parkinglot/ccsession.cc src/bin/parkinglot/config.h.in src/bin/parkinglot/parkinglot.spec src/lib/bind-cfgd/python/bind-cfgd.py

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 23 09:41:59 UTC 2009


Author: jelte
Date: Mon Nov 23 09:41:58 2009
New Revision: 318

Log:
compile-time location for parkinglot.spec file
somewhat parse the commands structure in bigtool as they are sent by the config manager

Added:
    branches/jelte-datadef/src/bin/parkinglot/config.h.in
    branches/jelte-datadef/src/bin/parkinglot/parkinglot.spec
Modified:
    branches/jelte-datadef/configure.ac
    branches/jelte-datadef/src/bin/bigtool/run_bigtool.py
    branches/jelte-datadef/src/bin/parkinglot/ccsession.cc
    branches/jelte-datadef/src/lib/bind-cfgd/python/bind-cfgd.py

Modified: branches/jelte-datadef/configure.ac
==============================================================================
--- branches/jelte-datadef/configure.ac (original)
+++ branches/jelte-datadef/configure.ac Mon Nov 23 09:41:58 2009
@@ -64,6 +64,7 @@
                ])
 AC_OUTPUT([src/bin/bind-cfgd/bind-cfgd
            src/bin/bind10/bind10
+           src/bin/parkinglot/config.h
           ], [
            chmod +x src/bin/bind-cfgd/bind-cfgd
            chmod +x src/bin/bind10/bind10

Modified: branches/jelte-datadef/src/bin/bigtool/run_bigtool.py
==============================================================================
--- branches/jelte-datadef/src/bin/bigtool/run_bigtool.py (original)
+++ branches/jelte-datadef/src/bin/bigtool/run_bigtool.py Mon Nov 23 09:41:58 2009
@@ -27,8 +27,28 @@
 
     bigtool.add_module_info(zone_module)
     bigtool.add_module_info(boss_module)
+
+def prepare_data_module(bigtool, module_name, module_commands):
+    module = ModuleInfo(name = module_name,
+                        desc = "same here")
+    for command in module_commands:
+        cmd = CommandInfo(name = command["command_name"],
+                          desc = "todo2",
+                          need_inst_param = False)
+        for arg in command["command_args"]:
+            param = ParamInfo(name = arg["item_name"],
+                              type = arg["item_type"],
+                              optional = bool(arg["item_optional"]))
+            if ("item_default" in arg):
+                param.default = arg["item_default"]
+            cmd.add_param(param)
+        module.add_command(cmd)
+    bigtool.add_module_info(module)
+
+def prepare_data(bigtool, command_spec):
+    for module_name in command_spec.keys():
+        prepare_data_module(bigtool, module_name, command_spec[module_name])
     
-
 if __name__ == '__main__':
     try:
         cc = ISC.CC.Session()
@@ -37,6 +57,9 @@
         cc.group_subscribe("Boss", "*", "meonly")
 
         tool = BigTool(cc)
+        cc.group_sendmsg({ "command": ["get_commands"] }, "ConfigManager")
+        command_spec, env =  cc.group_recvmsg(False)
+        prepare_data(tool, command_spec["result"])
         _prepare_fake_data(tool)   
         tool.cmdloop()
     except ISC.CC.SessionError:

Modified: branches/jelte-datadef/src/bin/parkinglot/ccsession.cc
==============================================================================
--- branches/jelte-datadef/src/bin/parkinglot/ccsession.cc (original)
+++ branches/jelte-datadef/src/bin/parkinglot/ccsession.cc Mon Nov 23 09:41:58 2009
@@ -38,6 +38,7 @@
 
 #include "common.h"
 #include "ccsession.h"
+#include "config.h"
 
 using namespace std;
 
@@ -52,9 +53,9 @@
     std::ifstream file;
 
     // this file should be declared in a @something@ directive
-    file.open("parkinglot.spec");
+    file.open(PARKINGLOT_SPECFILE_LOCATION);
     if (!file) {
-        cout << "error opening parkinglot.spec" << endl;
+        cout << "error opening " << PARKINGLOT_SPECFILE_LOCATION << endl;
         exit(1);
     }
 

Modified: branches/jelte-datadef/src/lib/bind-cfgd/python/bind-cfgd.py
==============================================================================
--- branches/jelte-datadef/src/lib/bind-cfgd/python/bind-cfgd.py (original)
+++ branches/jelte-datadef/src/lib/bind-cfgd/python/bind-cfgd.py Mon Nov 23 09:41:58 2009
@@ -85,7 +85,7 @@
             try:
                 if cmd[0] == "get_commands":
                     answer["result"] = self.commands
-                if cmd[0] == "zone" and cmd[1] == "add":
+                elif cmd[0] == "zone" and cmd[1] == "add":
                     self.add_zone(cmd[2])
                     answer["result"] = [ 0 ]
                 elif cmd[0] == "zone" and cmd[1] == "remove":




More information about the bind10-changes mailing list