Commit 0bddf9ff authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1451] add stub DDNSSession object and some spec data

parent bf289fc6
......@@ -59,6 +59,21 @@ class DDNSSessionError(Exception):
'''
pass
class DDNSSession:
"""Class to handle one DDNS update"""
def __init__(self):
self._handle()
def _handle(self):
'''
Handle a DDNS update.
This should be called from the initializer, and should contain the
logic for doing the checks, handling the update, and responding with
the result.
'''
pass
class DDNSServer:
def __init__(self):
self._cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
......@@ -71,14 +86,8 @@ class DDNSServer:
def config_handler(self, new_config):
'''Update config data.'''
answer = create_answer(0)
for key in new_config:
if key not in self._config_data:
answer = create_answer(1, "Unknown config data: " + str(key))
continue
self._config_data[key] = new_config[key]
return answer
def command_handler(self, cmd, args):
if cmd == "shutdown":
logger.info(DDNS_RECEIVED_SHUTDOWN_COMMAND)
......
{
"module_spec": {
"module_name": "DDNS",
"config_data": [
],
"commands": [
{
"command_name": "shutdown",
"command_description": "Shut down DDNS",
"command_args": []
"module_name": "DDNS",
"config_data": [
{
"item_name": "zones",
"item_type": "named_set",
"item_optional": false,
"item_default": {},
"named_set_item_spec": {
"item_name": "entry",
"item_type": "map",
"item_optional": true,
"item_default": {
"update_acls": [{"action": "ACCEPT", "from": "127.0.0.1"},
{"action": "ACCEPT", "from": "::1"}]
},
"map_item_spec": [
{
"item_name": "update_acls",
"item_type": "list",
"item_optional": false,
"list_item_spec": {
"item_name": "acl_element",
"item_type": "any",
"item_optional": true
}
}
]
}
]
}
],
"commands": [
{
"command_name": "shutdown",
"command_description": "Shut down DDNS",
"command_args": []
}
]
}
}
Supports Markdown
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