From: Michal 'vorner' Vaner Date: Mon, 18 Jun 2012 14:07:58 +0000 (+0200) Subject: [1976] Spec file for data sources X-Git-Tag: trac2351_base~97^2~7^2~2^2~21^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fa13ec3115f58573bc2fd6213a99be1c8435462;p=thirdparty%2Fkea.git [1976] Spec file for data sources --- diff --git a/src/bin/cfgmgr/plugins/Makefile.am b/src/bin/cfgmgr/plugins/Makefile.am index 5a4cfef4c3..a6a33621c1 100644 --- a/src/bin/cfgmgr/plugins/Makefile.am +++ b/src/bin/cfgmgr/plugins/Makefile.am @@ -1,11 +1,11 @@ SUBDIRS = tests -EXTRA_DIST = README logging.spec tsig_keys.spec +EXTRA_DIST = README logging.spec tsig_keys.spec datasrc.spec config_plugindir = @prefix@/share/@PACKAGE@/config_plugins -config_plugin_DATA = logging.spec tsig_keys.spec +config_plugin_DATA = logging.spec tsig_keys.spec datasrc.spec -python_PYTHON = b10logging.py tsig_keys.py +python_PYTHON = b10logging.py tsig_keys.py datasrc.py pythondir = $(config_plugindir) CLEANFILES = b10logging.pyc tsig_keys.pyc diff --git a/src/bin/cfgmgr/plugins/datasrc.py b/src/bin/cfgmgr/plugins/datasrc.py new file mode 100644 index 0000000000..f675aba7b6 --- /dev/null +++ b/src/bin/cfgmgr/plugins/datasrc.py @@ -0,0 +1,36 @@ +# Copyright (C) 2012 Internet Systems Consortium. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM +# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +from isc.config.module_spec import module_spec_from_file +from isc.util.file import path_search +from bind10_config import PLUGIN_PATHS +spec = module_spec_from_file(path_search('datasrc.spec', PLUGIN_PATHS)) + +def check(config): + """ + Check the configuration. + """ + # TODO: Once we have solved ticket #2051, create the list and + # fill it with the configuration. We probably want to have some way + # to not load the data sources, just the configuration. It could + # be hacked together by subclassing ConfigurableClientList and + # having empty getDataSource method. But it looks like a hack and it + # won't really check the params configuration. + # + # For now, we let everything pass. + return None + +def load(): + return (spec, check) diff --git a/src/bin/cfgmgr/plugins/datasrc.spec b/src/bin/cfgmgr/plugins/datasrc.spec new file mode 100644 index 0000000000..b85330e039 --- /dev/null +++ b/src/bin/cfgmgr/plugins/datasrc.spec @@ -0,0 +1,41 @@ +{ + "module_spec": { + "module_name": "data_sources", + "module_description": "The sources of authoritative DNS data", + "config_data": [ + { + "item_name": "classes", + "item_type": "named_set", + "item_optional": false, + "item_default": {}, + "named_set_item_spec": { + "item_name": "class", + "item_type": "list", + "item_optional": false, + "item_default": [], + "list_item_spec": { + "item_name": "source", + "item_type": "map", + "item_optional": false, + "item_default": {}, + "map_item_spec": [ + { + "item_name": "type", + "item_type": "string", + "item_optional": false, + "item_default": "" + }, + { + "item_name": "params", + "item_type": "any", + "item_optional": false, + "item_default": null + } + ] + } + } + } + ], + "commands": [] + } +} diff --git a/src/bin/cfgmgr/plugins/tests/Makefile.am b/src/bin/cfgmgr/plugins/tests/Makefile.am index ffea2d7011..9b8b925100 100644 --- a/src/bin/cfgmgr/plugins/tests/Makefile.am +++ b/src/bin/cfgmgr/plugins/tests/Makefile.am @@ -1,5 +1,5 @@ PYCOVERAGE_RUN = @PYCOVERAGE_RUN@ -PYTESTS = tsig_keys_test.py logging_test.py +PYTESTS = tsig_keys_test.py logging_test.py datasrc_test.py EXTRA_DIST = $(PYTESTS)