]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1976] Spec file for data sources
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 18 Jun 2012 14:07:58 +0000 (16:07 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 18 Jun 2012 14:07:58 +0000 (16:07 +0200)
src/bin/cfgmgr/plugins/Makefile.am
src/bin/cfgmgr/plugins/datasrc.py [new file with mode: 0644]
src/bin/cfgmgr/plugins/datasrc.spec [new file with mode: 0644]
src/bin/cfgmgr/plugins/tests/Makefile.am

index 5a4cfef4c3fbc525bd3fba73607425121340b6c9..a6a33621c13f3b914a70487ed69258ea35f9d1de 100644 (file)
@@ -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 (file)
index 0000000..f675aba
--- /dev/null
@@ -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 (file)
index 0000000..b85330e
--- /dev/null
@@ -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": []
+    }
+}
index ffea2d7011ef8852a8e552d7f94e916a073b9f98..9b8b925100f925a3bf431bdc85027564b7b301f7 100644 (file)
@@ -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)