Commit 6a70f64c authored by Jelte Jansen's avatar Jelte Jansen
Browse files

'stub' call to CCSession from bob, and mini-sample-specfile


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@567 e5f2f494-b856-4b98-b285-d166d9295462
parent 8541de1b
......@@ -8,7 +8,7 @@ BIND10_PATH=@abs_top_srcdir@/src/bin/bind10
PATH=@abs_top_srcdir@/src/bin/msgq:@abs_top_srcdir@/src/bin/parkinglot:@abs_top_srcdir@/src/bin/bind-cfgd:@abs_top_srcdir@/src/bin/cmd-ctrld:$PATH
export PATH
PYTHONPATH=@abs_top_srcdir@/src/lib/cc/python:${abs_top_src_dir}/lib/cc/python/ISC
PYTHONPATH=@abs_top_srcdir@/src/lib/cc/python:@abs_top_srcdir@/src/lib/config/python
export PYTHONPATH
cd ${BIND10_PATH}
......
......@@ -33,6 +33,7 @@ import pprint
from optparse import OptionParser, OptionValueError
import ISC.CC
import isc
# This is the version that gets displayed to the user.
__version__ = "v20091030 (Paving the DNS Parking Lot)"
......@@ -88,6 +89,17 @@ class BoB:
self.dead_processes = {}
self.runnable = False
def config_handler(self, new_config):
if self.verbose:
print("[XX] handling new config:")
print(new_config)
def command_handler(self, command):
if self.verbose:
print("[XX] Boss got command:")
print(command)
return None
def startup(self):
"""Start the BoB instance.
......@@ -133,6 +145,17 @@ class BoB:
if self.verbose:
sys.stdout.write("Started bind-cfgd (PID %d)\n" % bind_cfgd.pid)
# TODO: once this interface is done, replace self.cc_session
# by this one
# sleep until bind-cfgd is fully up and running, this is a good place
# to have a (short) timeout on synchronized groupsend/receive
time.sleep(1)
if self.verbose:
print("[XX] starting ccsession")
self.ccs = isc.config.CCSession("bob", "bob.spec", self.config_handler, self.command_handler)
if self.verbose:
print("[XX] ccsession started")
# start the parking lot
# XXX: this must be read from the configuration manager in the future
# XXX: we hardcode port 5300
......@@ -164,6 +187,7 @@ class BoB:
sys.stdout.write("Started cmd-ctrld (PID %d)\n" % cmd_ctrld.pid)
self.runnable = True
return None
def stop_all_processes(self):
......
{
"data_specification": {
"module_name": "Boss",
"config_data": [
{
"item_name": "some_string",
"item_type": "string",
"item_optional": False,
"item_default": "Hi, shane!"
}
],
"commands": [
{
"command_name": "print_message",
"command_description": "Print the given message to stdout",
"command_args": [ {
"item_name": "message",
"item_type": "string",
"item_optional": False,
"item_default": ""
} ]
}
]
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment