summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-22 19:48:28 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-23 09:03:13 +0200
commitef4deb58b86b30630ada347c110b35dd741a9101 (patch)
tree675c78b69d702076a74ed880ef185d9e697d9ea2 /scripts
parent785af7cf6603a81adc432537bf97987f59d818a3 (diff)
downloadvyos-1x-ef4deb58b86b30630ada347c110b35dd741a9101.tar.gz
vyos-1x-ef4deb58b86b30630ada347c110b35dd741a9101.zip
scripts: op-mode: use Python 'f'ormat strings on debug messages
(cherry picked from commit 252bc820b0d130d8d81b5711586eca41287abdca)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-command-op-templates17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/build-command-op-templates b/scripts/build-command-op-templates
index c285ee594..d0e5833cc 100755
--- a/scripts/build-command-op-templates
+++ b/scripts/build-command-op-templates
@@ -54,7 +54,7 @@ debug = args.debug
try:
xml = ET.parse(input_file)
except Exception as e:
- print("Failed to load interface definition file {0}".format(input_file))
+ print(f"Failed to load interface definition file {input_file}")
print(e)
sys.exit(1)
@@ -64,15 +64,15 @@ try:
if not validator.validate(xml):
print(validator.error_log)
- print("Interface definition file {0} does not match the schema!".format(input_file))
+ print(f"Interface definition file {input_file} does not match the schema!")
sys.exit(1)
except Exception as e:
- print("Failed to load the XML schema {0}".format(schema_file))
+ print(f"Failed to load the XML schema {schema_file}")
print(e)
sys.exit(1)
if not os.access(output_dir, os.W_OK):
- print("The output directory {0} is not writeable".format(output_dir))
+ print(f"The output directory {output_dir} is not writeable")
sys.exit(1)
## If we got this far, everything must be ok and we can convert the file
@@ -160,14 +160,14 @@ def process_node(n, tmpl_dir):
my_tmpl_dir.append(name)
if debug:
- print("Name of the node: {};\n Created directory: ".format(name), end="")
+ print(f"Name of the node: {name};\n Created directory: ", end="")
os.makedirs(make_path(my_tmpl_dir), exist_ok=True)
props = get_properties(props_elem)
if node_type == "node":
if debug:
- print("Processing node {}".format(name))
+ print(f"Processing node {name}")
nodedef_path = os.path.join(make_path(my_tmpl_dir), "node.def")
# Only create the "node.def" file if it exists but is empty, or if it
@@ -180,9 +180,10 @@ def process_node(n, tmpl_dir):
inner_nodes = children.iterfind("*")
for inner_n in inner_nodes:
process_node(inner_n, my_tmpl_dir)
+
if node_type == "tagNode":
if debug:
- print("Processing tag node {}".format(name))
+ print(f"Processing tagNode {name}")
os.makedirs(make_path(my_tmpl_dir), exist_ok=True)
@@ -211,7 +212,7 @@ def process_node(n, tmpl_dir):
else:
# This is a leaf node
if debug:
- print("Processing leaf node {}".format(name))
+ print(f"Processing leaf node {name}")
with open(os.path.join(make_path(my_tmpl_dir), "node.def"), "w") as f:
f.write(make_node_def(props, command))