summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-14 17:32:12 +0100
committerGitHub <noreply@github.com>2021-01-14 17:32:12 +0100
commit86503b264707c9f076423f53b783bd45c335a7c4 (patch)
tree75d1b1d7dc2237f492b1ab9dc6f24b43186a084b /scripts
parent1a58bfde9ad954935b9e26d9d3617a9cceb136be (diff)
parent188f2171c62af50c95cda38e2bb86e7cf47413bd (diff)
downloadvyos-1x-86503b264707c9f076423f53b783bd45c335a7c4.tar.gz
vyos-1x-86503b264707c9f076423f53b783bd45c335a7c4.zip
Merge pull request #673 from dmbaturin/separate-base-nodes
T3165: use a separate file for "base" CLI nodes.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-command-op-templates1
-rwxr-xr-xscripts/build-command-templates15
2 files changed, 12 insertions, 4 deletions
diff --git a/scripts/build-command-op-templates b/scripts/build-command-op-templates
index c60b32a1e..54cc07794 100755
--- a/scripts/build-command-op-templates
+++ b/scripts/build-command-op-templates
@@ -193,6 +193,7 @@ def process_node(n, tmpl_dir):
f.write('help: {0}\n'.format(props['help']))
else:
# Something has already generated this file
+ print("Warning: refusing to overwrite already existing file {}".format(nodedef_path))
pass
# Create the inner node.tag part
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index d6585b0cc..f09941e68 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -3,7 +3,7 @@
# build-command-template: converts new style command definitions in XML
# to the old style (bunch of dirs and node.def's) command templates
#
-# Copyright (C) 2017 VyOS maintainers <maintainers@vyos.net>
+# Copyright (C) 2017,2021 VyOS maintainers <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -279,19 +279,26 @@ def process_node(n, tmpl_dir):
f.write(make_node_def(props))
else:
# Something has already generated that file
+ print("Warning: refusing to overwrite already existing file {}".format(nodedef_path))
pass
- if node_type == "node":
+ if (node_type == "node") and (children is None):
+ print("Warning: non-leaf, non-tag <node> without children may be incomplete ({})".format(nodedef_path))
+ pass
+ elif node_type == "node":
inner_nodes = children.iterfind("*")
for inner_n in inner_nodes:
process_node(inner_n, my_tmpl_dir)
- if node_type == "tagNode":
+ elif node_type == "tagNode":
+ if children is None:
+ raise ValueError("A <tagNode> without children is not allowed")
+
+ inner_nodes = children.iterfind("*")
my_tmpl_dir.append("node.tag")
if debug:
print("Created path for the tagNode:", end="")
os.makedirs(make_path(my_tmpl_dir), exist_ok=True)
- inner_nodes = children.iterfind("*")
for inner_n in inner_nodes:
process_node(inner_n, my_tmpl_dir)
else: