-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: 404 when build_chroot is not found in database from task_id #3649
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
from sqlalchemy.sql import false,true | ||
from werkzeug.utils import secure_filename | ||
from sqlalchemy import bindparam, Integer, String | ||
from sqlalchemy.exc import IntegrityError, NoResultFound | ||
from sqlalchemy.exc import DataError, IntegrityError, NoResultFound | ||
|
||
from copr_common.enums import FailTypeEnum, StatusEnum | ||
from coprs import app | ||
|
@@ -460,8 +460,8 @@ def get_build_task(cls, task_id): | |
except ValueError: | ||
raise MalformedArgumentException("Invalid task_id {}".format(task_id)) | ||
|
||
build_chroot = BuildChrootsLogic.get_by_build_id_and_name(build_id, chroot_name) | ||
try: | ||
build_chroot = BuildChrootsLogic.get_by_build_id_and_name(build_id, chroot_name) | ||
return build_chroot.join(models.Build).one() | ||
except NoResultFound as ex: | ||
raise ObjectNotFound("Specified task ID not found") from ex | ||
|
@@ -1498,13 +1498,18 @@ def new(cls, build, mock_chroot, **kwargs): | |
|
||
@classmethod | ||
def get_by_build_id_and_name(cls, build_id, name): | ||
mc = MockChrootsLogic.get_from_name(name).one() | ||
try: | ||
mc = MockChrootsLogic.get_from_name(name).one() | ||
|
||
return ( | ||
BuildChroot.query | ||
.filter(BuildChroot.build_id == build_id) | ||
.filter(BuildChroot.mock_chroot_id == mc.id) | ||
) | ||
return ( | ||
BuildChroot.query | ||
.filter(BuildChroot.build_id == build_id) | ||
.filter(BuildChroot.mock_chroot_id == mc.id) | ||
) | ||
except DataError as ex: | ||
raise MalformedArgumentException( | ||
f"Invalid build_id: {build_id} or name: {name}" | ||
) from ex | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure where the DataError comes from. Do we really need this part at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reproducer: https://copr.fedorainfracloud.org/backend/get-build-task/6742s605-fedora-39-aarch64 but looking at usage of this method... it's only used for backend related part so it really isn't a big deal tbh and it can be dropped |
||
|
||
@classmethod | ||
def get_multiply(cls): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a valid code movement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, that's maybe the only thing I would want to accept right now from this PR