public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: bunsen@sourceware.org
Subject: [PATCH] Fix Bunsen.testrun(commit_id)
Date: Fri, 30 Jul 2021 12:22:41 -0700	[thread overview]
Message-ID: <20210730192241.3490696-1-keiths@redhat.com> (raw)

The recent refactor commit a69fcff1 broke clients calling Bunsen.testrun
with a commit ID:

$ ./bunsen.py +summarize 60231993624ee6fa5ced3c8f4ae13bdeda3a94cf
Using branch index, checkout name wd-summarize
Running summarize at .../bunsen/.bunsen/wd-summarize from .../bunsen/scripts-main/summarize.py with ['60231993624ee6fa5ced3c8f4ae13bdeda3a94cf']
===
Traceback (most recent call last):
  File ".../bunsen/scripts-main/summarize.py", line 40, in <module>
    testrun = b.testrun(opts.commit)
  File ".../bunsen/bunsen/repo.py", line 906, in testrun
    candidate_branches.append(testrun_summary.bunsen_testruns_branch)
AttributeError: 'NoneType' object has no attribute 'bunsen_testruns_branch'

This is occurring because the code attempts to use `testrun_summary' in
a place where it is undefined:

        if project is None and extra_info is not None \
            and 'bunsen_testruns_branch' in extra_info:
            testrun_project, testrun_year_month, testrun_extra_label = \
                extra_info.commit_tag()
            project = testrun_project
            candidate_branches.append(testrun_summary.bunsen_testruns_branch)

`testrun_summary' is only defined when `testrun_or_commit_id' is an
instance of Testrun. In this case, we have a string representing the
commit ID.

Since `project' is None just before this block, `extra_info' is initialized
to a Testrun object. It is this object, therefore, in which we should
look for `bunsen_testruns_branch'.

This fixes scripts-master/summarize.py.
---
 bunsen/repo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bunsen/repo.py b/bunsen/repo.py
index bc0b982..4d11a87 100644
--- a/bunsen/repo.py
+++ b/bunsen/repo.py
@@ -903,7 +903,7 @@ class Bunsen:
             testrun_project, testrun_year_month, testrun_extra_label = \
                 extra_info.commit_tag()
             project = testrun_project
-            candidate_branches.append(testrun_summary.bunsen_testruns_branch)
+            candidate_branches.append(extra_info.bunsen_testruns_branch)
 
         # Option 3: get project,year_month from commit message header.
         if project is None:
-- 
2.31.1


                 reply	other threads:[~2021-07-30 19:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210730192241.3490696-1-keiths@redhat.com \
    --to=keiths@redhat.com \
    --cc=bunsen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).