#286 Treat "brew-build" subject type as an alias for "koji_build"
Merged by gnaponie. Opened by mprahl.
Unknown source master

Download 286.patch

Greenwave expects only values of koji_build since that's what the policies apply to and it seems like this aliasing in WaiverDB only applied to older style POST requests.

But the pylint is failing... can you fix it?

22:52:42 [Invoke Pylint] + pylint-3 --reports=n waiverdb
[Pipeline] [Invoke Flake8] }
[Pipeline] [Invoke Flake8] // stage
[Pipeline] [Invoke Flake8] }
22:53:21 [Invoke Pylint] *** Module waiverdb.api_v1
22:53:21 [Invoke Pylint] W:380, 0: Bad indentation. Found 16 spaces, expected 12 (bad-indentation)
22:53:21 [Invoke Pylint]
22:53:21 [Invoke Pylint] -----------------------------------
22:53:21 [Invoke Pylint] Your code has been rated at 9.99/10
22:53:21 [Invoke Pylint]

Here's the pylint failure, it is over-indented

Actually... I'm not sure this is a correct change. It is true that there is some confusion around "koji_build" and "brew-build" subject types. But the problem that this PR is trying to address won't solve it. In my opinion the problem is that there isn't a policy for the specified testcase in the waiver (osci.brew-build.tier0.functional). In that case the user should define a policy with that testcase and "brew-build" as subject_type. The user shouldn't expect waiverdb to handle a mistake in the configuration... What if someone actually defined as subject type "brew-build"? Same thing in greenwave policies? That would get ignored... That's my opinion at least.

Or... maybe there is some remote policy that I didn't see? I'll check. Anyhow... still this would create problem if someone actually defined "brew-build" in the waiver and in the policy.

rebased onto 5f75f1ef197d7cae73bdfbdd3484bb64d803e08d

I fixed the pylint issue. That was a copy/paste error on part. Let's meet about why I think this will resolve the issue.

We discussed a bit about it and it seems like this is a good change.
The reason is that Greenwave accepts the RemoteRule only for koji_build(s) and redhat_module(s). At some point Greenwave converts "brew-build" to "koji_build", so that's why it works there. But it doesn't work if you create a waiver, because WaiverDB does the conversion only if you pass to the CLI the result_id and not with subject_type and subject_identifier (this mode is also useful for waiving some result that still doesn't exist).

We can merge this change and maybe refactor and improve in the future this koji_build/brew-build thing.

Pull-Request has been merged by gnaponie

Metadata