#304 Add BaseEvent.is_allowed method to check if the event passes configured whitelist/blacklist.
Merged by jkaluza. Opened by jkaluza.
jkaluza/freshmaker base-event-is-allowed  into  master

Download 304.patch

We use multiple BaseHandler.allow_build(...) calls to check whether the advisory/image is allowed by whitelist/blacklist. This is necessary, because at first we only check whether the advisory is allowed to trigger the rebuild - this is the first call. Later we call BaseHandler.allow_build(...) again but also with particular image name to find out whether particular image can be rebuilt - this is second call. There are also other cases similar to this one.

The issue is that every call of allow_build(...) must contain all of the Event's metadata and since we always constructed allow_build arguments from scratch for every call on various places, it was hard to maintain it on multiple places. We for example added advisory_has_hightouch_bug key, but filled it only on single place where allow_build is called for Errata advisory.

This PR fixes that by introducing BaseEvent.is_allowed(...) method which calls BaseHandler.allow_build() with all the attributes particular Event provides. Therefore the list of attributes are in single file in the particular Event's class.

rebased onto df8aeaa43e55454eca56a2be1fae67321cd95a08

rebased onto 423d6c4f46699b16a514c5675af5b066b6aeb024

Do you really need *args here? **kwargs, yes... but it looks like *args may always be empty. Can it be dropped for clarity?

:+1: in general. I left one comment - take it or leave it. :)

Fixed, merging.

rebased onto 8743b70e28131c053ca15dbf5989370f0b6971d0

Commit 8369cf37 fixes this pull-request

Pull-Request has been merged by jkaluza

Pull-Request has been merged by jkaluza

Metadata