summaryrefslogtreecommitdiff
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
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.
-rw-r--r--Makefile11
-rw-r--r--schema/interface_definition.rng5
-rwxr-xr-xscripts/build-command-templates17
3 files changed, 9 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index d194b44e4..de7c136eb 100644
--- a/Makefile
+++ b/Makefile
@@ -13,17 +13,6 @@ interface_definitions:
rm -f $(TMPL_DIR)/service/dns/node.def
rm -f $(TMPL_DIR)/protocols/node.def
- # Workaround for T604: vyos-1x: node.def generation always contains "type: txt"
- sed -i '/^type: txt/d' $(TMPL_DIR)/service/dns/forwarding/ignore-hosts-file/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/service/dns/forwarding/system/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/system/ntp/server/node.tag/dynamic/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/system/ntp/server/node.tag/noselect/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/system/ntp/server/node.tag/preempt/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/system/ntp/server/node.tag/prefer/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/service/ssh/allow-root/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/service/ssh/disable-host-validation/node.def
- sed -i '/^type: txt/d' $(TMPL_DIR)/service/ssh/disable-password-authentication/node.def
-
.PHONY: all
all: interface_definitions
diff --git a/schema/interface_definition.rng b/schema/interface_definition.rng
index 5a0a48845..d1bd9a708 100644
--- a/schema/interface_definition.rng
+++ b/schema/interface_definition.rng
@@ -169,11 +169,6 @@
</element>
</optional>
<optional>
- <element name="type">
- <text/>
- </element>
- </optional>
- <optional>
<!-- These are meaningful only for tag nodes -->
<group>
<element name="keepChildOrder">
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"