Skip to content

Commit

Permalink
frontend: don't traceback on generating tasks for disabled chroots
Browse files Browse the repository at this point in the history
This happens in cases like fedora-copr#2904 and infinitely produces the following
tracebacks:

    ERROR:coprs:'NoneType' object has no attribute 'module_setup_commands'
    Traceback (most recent call last):
      File "/usr/share/copr/coprs_frontend/coprs/views/backend_ns/backend_general.py", line 175, in get_build_record
        modules = copr_chroot.module_setup_commands
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'module_setup_commands'
  • Loading branch information
FrostyX committed Sep 8, 2023
1 parent 80745da commit 002c4ab
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def get_build_record(task, for_backend=False):
})

copr_chroot = CoprChrootsLogic.get_by_name_safe(task.build.copr, task.mock_chroot.name)
if not copr_chroot:
app.logger.error("The %s chroot is disabled (build %s)",
task.mock_chroot.name, task.build.id)
return None

modules = copr_chroot.module_setup_commands
if modules:
build_record["modules"] = {'toggle': modules}
Expand Down

0 comments on commit 002c4ab

Please sign in to comment.