summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--interface-definitions/cron.xml7
-rwxr-xr-xscripts/build-command-templates19
3 files changed, 24 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2c7b28c56..3da3a369f 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,9 @@ TMPL_DIR := templates
interface_definitions:
find $(CURDIR)/interface-definitions/ -type f | xargs -I {} $(CURDIR)/scripts/build-command-templates {} $(CURDIR)/schema/interface_definition.rng $(TMPL_DIR)
+ # XXX: delete top level node.def's that now live in other packages
+ rm $(TMPL_DIR)/system/node.def
+
.PHONY: all
all: interface_definitions
diff --git a/interface-definitions/cron.xml b/interface-definitions/cron.xml
index 1982ac87c..8ea291a2e 100644
--- a/interface-definitions/cron.xml
+++ b/interface-definitions/cron.xml
@@ -3,11 +3,14 @@
<!-- Cron configuration -->
<interfaceDefinition>
- <node name="system" owner="vyos-update-cron">
+ <node name="system">
<children>
<node name="task-scheduler">
+ <properties>
+ <help>Task scheduler settings</help>
+ </properties>
<children>
- <tagNode name="task">
+ <tagNode name="task" owner="${vyatta_sbindir}/vyos-update-crontab.py">
<properties>
<help>Scheduled task</help>
<valueHelp>
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index 3c95bde21..17442bfcb 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -70,7 +70,7 @@ def make_path(l):
return(functools.reduce(os.path.join, l))
def get_properties(p):
- props = {"tag": False, "type": "txt"}
+ props = {}
if p is None:
return props
@@ -97,6 +97,10 @@ def get_properties(p):
except:
pass
+ # Get "multi"
+ if p.find("multi") is not None:
+ props["multi"] = True
+
return props
def make_node_def(props):
@@ -108,7 +112,11 @@ def make_node_def(props):
if "tag" in props:
node_def += "tag:\n"
- node_def += "type: {0}\n".format(props["type"])
+ if "type" in props:
+ node_def += "type: {0}\n".format(props["type"])
+
+ if "multi" in props:
+ node_def += "multi:\n"
if "priority" in props:
node_def += "priority: {0}\n".format(props["priority"])
@@ -135,6 +143,7 @@ def process_node(n, tmpl_dir):
name = n.get("name")
owner = n.get("owner")
+ node_type = n.tag
my_tmpl_dir.append(name)
os.makedirs(make_path(my_tmpl_dir), exist_ok=True)
@@ -142,13 +151,17 @@ def process_node(n, tmpl_dir):
props = get_properties(props_elem)
if owner:
props["owner"] = owner
+ # Type should not be set for non-tag, non-leaf nodes
+ if node_type != "node":
+ props["type"] = "txt"
+ if node_type == "tagNode":
+ props["tag"] = "True"
with open(os.path.join(make_path(my_tmpl_dir), "node.def"), "w") as f:
f.write(make_node_def(props))
- node_type = n.tag
if node_type == "node":
inner_nodes = children.iterfind("*")
for inner_n in inner_nodes: