From 002c4ab12e75b3e62edc14abd70bad4c05adff51 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Fri, 8 Sep 2023 23:54:03 +0200 Subject: [PATCH] frontend: don't traceback on generating tasks for disabled chroots This happens in cases like #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' --- .../coprs_frontend/coprs/views/backend_ns/backend_general.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py index 8a7b4c34a..0fde0791e 100755 --- a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py +++ b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py @@ -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}