diff options
| author | Daniil Baturin <daniil@baturin.org> | 2017-09-08 00:50:23 +0200 | 
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2017-09-08 00:50:23 +0200 | 
| commit | 8964d2aaf758962704214fb4325b45c0c11134fa (patch) | |
| tree | db64c127d6bb7c94e5f0ead1c696a2346f572f91 /scripts/build-command-templates | |
| parent | b626e36f45a5cb24da4b69ec6de06ea84710e9bd (diff) | |
| download | vyos-1x-8964d2aaf758962704214fb4325b45c0c11134fa.tar.gz vyos-1x-8964d2aaf758962704214fb4325b45c0c11134fa.zip  | |
Fix handling of tag and multi nodes in the convertor.
Ugly fixup in the makefile to delete generated node.def's that are now in other packages.
Adjust the cron interface definition to better match the old templates.
Diffstat (limited to 'scripts/build-command-templates')
| -rwxr-xr-x | scripts/build-command-templates | 19 | 
1 files changed, 16 insertions, 3 deletions
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:  | 
