summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaniadz <tdziubenko@ukr.net>2017-09-12 02:05:08 +0300
committerTaniadz <tdziubenko@ukr.net>2017-09-12 02:05:08 +0300
commitecdbe7b6fb64ae7d27d9147aa2c4a55b3a491735 (patch)
treec1c623d639226d0a33145f92fb1ef94af2b25d15
parent67ff7166a77a6d7c0eb5d01615898e353588c4bf (diff)
downloadvyos-1x-ecdbe7b6fb64ae7d27d9147aa2c4a55b3a491735.tar.gz
vyos-1x-ecdbe7b6fb64ae7d27d9147aa2c4a55b3a491735.zip
Add debug mode to the build-command-templates script
-rwxr-xr-xscripts/build-command-templates21
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index 3ed205c07..ccd87829b 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -22,9 +22,11 @@
import sys
import os
+import getopt
import copy
import functools
+
from lxml import etree as ET
@@ -38,6 +40,16 @@ input_file = sys.argv[1]
schema_file = sys.argv[2]
output_dir = sys.argv[3]
+
+debug = False
+opts, args = getopt.getopt(sys.argv[4:], '', ['debug='])
+
+for opt, arg in opts:
+ if opt == '--debug':
+ if arg == "1":
+ debug = True
+
+
## Load and validate the inputs
try:
@@ -67,7 +79,10 @@ if not os.access(output_dir, os.W_OK):
## If we got this far, everything must be ok and we can convert the file
def make_path(l):
- return(functools.reduce(os.path.join, l))
+ path = functools.reduce(os.path.join, l)
+ if debug:
+ print(path)
+ return path
def get_properties(p):
props = {}
@@ -146,6 +161,8 @@ def process_node(n, tmpl_dir):
node_type = n.tag
my_tmpl_dir.append(name)
+ if debug:
+ print("Make dir for the node:", n)
os.makedirs(make_path(my_tmpl_dir), exist_ok=True)
props = get_properties(props_elem)
@@ -175,7 +192,7 @@ def process_node(n, tmpl_dir):
else:
# This is a leaf node
pass
-
+
root = xml.getroot()