summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-04-28 21:51:07 +0200
committerChristian Breunig <christian@breunig.cc>2025-04-28 22:10:08 +0200
commita41398d9289457794f3f2e66e1dded7804f3c080 (patch)
treea276fec6c42f4640e6b591a22ee2de18b93fb598
parentd4206a0885c080ef2e4b19ff33a30abc8b479dad (diff)
downloadvyos-1x-a41398d9289457794f3f2e66e1dded7804f3c080.tar.gz
vyos-1x-a41398d9289457794f3f2e66e1dded7804f3c080.zip
T7122: remove trailing chars and add new line for every template.render() call
-rwxr-xr-xpython/vyos/template.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index d79e1183f..513490963 100755
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -150,6 +150,8 @@ def render(
# As we are opening the file with 'w', we are performing the rendering before
# calling open() to not accidentally erase the file if rendering fails
rendered = render_to_string(template, content, formater, location)
+ # Remove any trailing character and always add a new line at the end
+ rendered = rendered.rstrip() + "\n"
# Write to file
with open(destination, "w") as file: