From 60ea684dfe0ad0428e724d6f7b32c1ba9aa819a8 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Fri, 15 Apr 2022 06:07:43 -0700 Subject: [PATCH] Fix: INFO job template and sanity_check call The INFO job template was improperly formatted. The sanity_check call is to a class method, and requires and positional argument for "self" (this does not need to contain anything; it is just filler in this case). Change-Id: I1dcbc456bf31e907821ab4c5aee7c324dbd70722 Signed-off-by: Eric Ball --- lftools/git/gerrit.py | 2 +- lftools/git/templates/project.yaml | 4 ++-- releasenotes/notes/fix-info-job-errors-22a82ecea0feb4fe.yaml | 4 ++++ tests/test_git.py | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/fix-info-job-errors-22a82ecea0feb4fe.yaml diff --git a/lftools/git/gerrit.py b/lftools/git/gerrit.py index 1d4a5e25..fe593e71 100644 --- a/lftools/git/gerrit.py +++ b/lftools/git/gerrit.py @@ -181,7 +181,7 @@ class Gerrit: gerrit_project test/test1 issue_id: CIMAN-33 """ - gerrit_api.sanity_check(self.fqdn, gerrit_project) + gerrit_api.sanity_check(None, self.fqdn, gerrit_project) filename = ".gitreview" jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape()) diff --git a/lftools/git/templates/project.yaml b/lftools/git/templates/project.yaml index 59d8ff13..53de692d 100644 --- a/lftools/git/templates/project.yaml +++ b/lftools/git/templates/project.yaml @@ -1,11 +1,11 @@ --- -project: +- project: name: {{ project_name_dashed }}-project-view project-name: {{ project_name_dashed }} views: - project-view -project: +- project: name: {{ project_name_dashed }}-info project: {{ project_name }} project-name: {{ project_name_dashed }} diff --git a/releasenotes/notes/fix-info-job-errors-22a82ecea0feb4fe.yaml b/releasenotes/notes/fix-info-job-errors-22a82ecea0feb4fe.yaml new file mode 100644 index 00000000..72dfa783 --- /dev/null +++ b/releasenotes/notes/fix-info-job-errors-22a82ecea0feb4fe.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fix template for INFO jobs and a bad call to sanity_check in git.gerrit. diff --git a/tests/test_git.py b/tests/test_git.py index aa108a7a..7a8d9eb3 100644 --- a/tests/test_git.py +++ b/tests/test_git.py @@ -84,13 +84,13 @@ def test_add_info_job(mock_init, datafiles, mocker): commit_msg = "Chore: Automation adds project-subproject.yaml" filepath = os.path.join(mock_init.repo.working_tree_dir, "jjb/project-subproject/project-subproject.yaml") content = """--- -project: +- project: name: project-subproject-project-view project-name: project-subproject views: - project-view -project: +- project: name: project-subproject-info project: project/subproject project-name: project-subproject -- 2.16.6