Skip to content
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

Better error for build removal attempt in persistent project #2019

Closed
fedora-copr-github-bot opened this issue Nov 18, 2022 · 0 comments
Closed
Assignees
Labels
easyfix RFE Enhancement, feature requests

Comments

@fedora-copr-github-bot
Copy link
Collaborator

fedora-copr-github-bot commented Nov 18, 2022

Original issue: https://pagure.io/copr/copr/issue/2019
Opened: 2021-12-22 07:36:38
Opened by: praiskup

$ copr delete-build 1951783

Something went wrong:
Error: You don't have permissions to delete build(s) 1951783.

In web-UI I get the same message:
https://copr.fedorainfracloud.org/coprs/g/mock/mock/build/1951783/

I'm builder and admin there (+ I'm admin of Copr instance).


praiskup commented at 2021-12-22 08:53:58:

Ah, it is a persistent project. We should have a better message there, like:
Error: Build(s) in persistent projects can not be removed: 1951783.


praiskup commented at 2021-12-22 08:57:06:

(FTR, I removed that build manually, as I believe the persistent flag is there by mistake)

@fedora-copr-github-bot fedora-copr-github-bot added the RFE Enhancement, feature requests label Nov 22, 2022
@praiskup praiskup self-assigned this Mar 20, 2023
praiskup added a commit to praiskup/copr that referenced this issue Mar 20, 2023
To work-around the missing abstraction in delete_build() logic, we
previously "faked" the user argument with the actual build.copr.owner,
with believe that it will never fail.

That `copr.owner` is actually not guaranteed to have build/admin access
to corresponding 'copr'.  Not after a4e7a5a.

Let's invent AutomationUser (having a common ancestor with User)
providing the necessary API to perform permission checks for build
removals, and grant the AutomationUser instances the necessary
permissions.

While on it, tweak the logging and error reporting a bit so there's is
more obvious what is going on.

Fixes: fedora-copr#2523
Fixes: fedora-copr#2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easyfix RFE Enhancement, feature requests
Projects
Archived in project
Development

No branches or pull requests

2 participants