summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-05-14 02:56:41 +0200
committerDaniil Baturin <daniil@baturin.org>2018-05-14 02:56:41 +0200
commitb58cf978599da16ca685f2b83b555ab53dde3071 (patch)
tree74ebb46678c38d08867cdccf363bc4b563e52e9e /scripts
parent00f4d8ad780001b9a3f534c32d485676bc97993a (diff)
downloadvyos-1x-b58cf978599da16ca685f2b83b555ab53dde3071.tar.gz
vyos-1x-b58cf978599da16ca685f2b83b555ab53dde3071.zip
T602: remove support for the type element and correct the logic for setting the type in generated command templates.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-command-templates17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index d1871c1c8..af46c10cf 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -131,7 +131,7 @@ def get_properties(p):
pass
if v_argument is None:
v_argument = ""
- vc.append("exec {0}/{1} {2} $VAR(@); {3}".format(validator_dir, v_name, v_argument, error_msg))
+ vc.append("exec \"{0}/{1} {2} $VAR(@)\"; \"{3}\"".format(validator_dir, v_name, v_argument, error_msg))
props["constraints"] = vc
except:
props["constraints"] = []
@@ -165,16 +165,14 @@ def get_properties(p):
except:
pass
- # Get type
- try:
- props["type"] = p.find("type").text
- except:
- pass
-
# Get "multi"
if p.find("multi") is not None:
props["multi"] = True
+ # Get "valueless"
+ if p.find("valueless") is not None:
+ props["valueless"] = True
+
return props
def make_node_def(props):
@@ -190,6 +188,7 @@ def make_node_def(props):
node_def += "multi:\n"
if "type" in props:
+ # Will always be txt in practice if it's set
node_def += "type: {0}\n".format(props["type"])
if "priority" in props:
@@ -238,8 +237,10 @@ def process_node(n, tmpl_dir):
if owner:
props["owner"] = owner
# Type should not be set for non-tag, non-leaf nodes
+ # For non-valueless leaf nodes, set the type to txt: to make them have some type,
+ # actual value validation is handled by constraints translated to syntax:expression:
if node_type != "node":
- if "type" not in props.keys():
+ if "valueless" not in props.keys():
props["type"] = "txt"
if node_type == "tagNode":
props["tag"] = "True"