From b58cf978599da16ca685f2b83b555ab53dde3071 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 14 May 2018 02:56:41 +0200 Subject: T602: remove support for the type element and correct the logic for setting the type in generated command templates. --- Makefile | 11 ----------- schema/interface_definition.rng | 5 ----- scripts/build-command-templates | 17 +++++++++-------- 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 @@ -168,11 +168,6 @@ - - - - - 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" -- cgit v1.2.3