Chore: add new lines required by pre-commit 43/71943/4 v0.37.6
authorKevin Sandi <ksandi@contractor.linuxfoundation.org>
Wed, 19 Jul 2023 23:28:41 +0000 (17:28 -0600)
committerKevin Sandi <ksandi@contractor.linuxfoundation.org>
Thu, 20 Jul 2023 18:34:57 +0000 (12:34 -0600)
Signed-off-by: Kevin Sandi <ksandi@contractor.linuxfoundation.org>
Change-Id: I659776622fefceb233f3a444ec38f5174a5d5054

lftools/git/gerrit.py
releasenotes/notes/pre-commit-fix-newlines-4c37e32a618b2483.yaml [new file with mode: 0644]

index ebf890f..0bc8a31 100644 (file)
@@ -160,7 +160,9 @@ class Gerrit:
             else:
                 buildnode = "centos7-builder-2c-1g"
 
-        jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape())
+        jinja_env = Environment(
+            loader=PackageLoader("lftools.git"), autoescape=select_autoescape(), keep_trailing_newline=True
+        )
         template = jinja_env.get_template("project.yaml")
         content = template.render(
             project_name_dashed=gerrit_project_dashed,
@@ -186,7 +188,9 @@ class Gerrit:
         """
         filename = ".gitreview"
 
-        jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape())
+        jinja_env = Environment(
+            loader=PackageLoader("lftools.git"), autoescape=select_autoescape(), keep_trailing_newline=True
+        )
         template = jinja_env.get_template("gitreview")
         content = template.render(fqdn=fqdn, project_name=gerrit_project, default_branch=self.default_branch)
         log.debug(".gitreview contents:\n{}".format(content))
@@ -239,7 +243,9 @@ class Gerrit:
             except AttributeError:
                 log.error("Invalid nexus3_ports designated.")
 
-        jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape())
+        jinja_env = Environment(
+            loader=PackageLoader("lftools.git"), autoescape=select_autoescape(), keep_trailing_newline=True
+        )
         template = jinja_env.get_template(params_path)
         config_params_content = template.render(project_dashed=project_dashed)
         log.debug("config-params.yaml contents:\n{}".format(config_params_content))
diff --git a/releasenotes/notes/pre-commit-fix-newlines-4c37e32a618b2483.yaml b/releasenotes/notes/pre-commit-fix-newlines-4c37e32a618b2483.yaml
new file mode 100644 (file)
index 0000000..507ea51
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Adds new lines at EOF of templates used by lftools to generate automated
+    Gerrit changes after a new INFO.yaml is merged.