Commit ffe26df9 authored by Jelte Jansen's avatar Jelte Jansen

same for bob


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/jelte-configuration@825 e5f2f494-b856-4b98-b285-d166d9295462
parent 51512f41
......@@ -119,13 +119,13 @@ class BoB:
if self.ccs.get_config_data().get_specification().validate(False, new_config, errors):
print("[XX] new config validated")
self.ccs.set_config(new_config)
answer = { "result": [ 0 ] }
answer = isc.config.ccsession.create_answer(0)
else:
print("[XX] new config validation failure")
if len(errors) > 0:
answer = { "result": [ 1, errors ] }
answer = isc.config.ccsession.create_answer(1, " ".join(errors))
else:
answer = { "result": [ 1, "Unknown error in validation" ] }
answer = isc.config.ccsession.create_answer(1, "Unknown error in validation")
return answer
# TODO
......@@ -136,23 +136,23 @@ class BoB:
print(command)
answer = [ 1, "Command not implemented" ]
if type(command) != list or len(command) == 0:
answer = { "result": [ 1, "bad command" ] }
answer = isc.config.ccsession.create_answer(1, "bad command")
else:
cmd = command[0]
if cmd == "shutdown":
print("[XX] got shutdown command")
self.runnable = False
answer = { "result": [ 0 ] }
answer = isc.config.ccsession.create_answer(0)
elif cmd == "print_message":
if len(command) > 1 and type(command[1]) == dict and "message" in command[1]:
print(command[1]["message"])
answer = { "result": [ 0 ] }
answer = isc.config.ccsession.create_answer(0)
elif cmd == "print_settings":
print("Config:")
print(self.ccs.get_config())
answer = { "result": [ 0 ] }
answer = isc.config.ccsession.create_answer(0)
else:
answer = { "result": [ 1, "Unknown command" ] }
answer = isc.config.ccsession.create_answer(1, "Unknown command")
return answer
def startup(self):
......
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