From: Jelte Jansen Date: Mon, 12 Dec 2011 13:35:14 +0000 (+0100) Subject: [1451] add stub DDNSSession object and some spec data X-Git-Tag: perftcpdns_before_epoll~5^2~8^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0bddf9ffefd543c9a67ec8d096a88290fc8a5dc3;p=thirdparty%2Fkea.git [1451] add stub DDNSSession object and some spec data --- diff --git a/src/bin/ddns/ddns.py.in b/src/bin/ddns/ddns.py.in index 54f108fce3..152d69f4f8 100755 --- a/src/bin/ddns/ddns.py.in +++ b/src/bin/ddns/ddns.py.in @@ -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) diff --git a/src/bin/ddns/ddns.spec.pre.in b/src/bin/ddns/ddns.spec.pre.in index f45b2f2cc1..03899e4b3f 100644 --- a/src/bin/ddns/ddns.spec.pre.in +++ b/src/bin/ddns/ddns.spec.pre.in @@ -1,15 +1,42 @@ { "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": [] + } + ] } }