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.
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 callBaseHandler.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 addedadvisory_has_hightouch_bugkey, but filled it only on single place whereallow_buildis called for Errata advisory.This PR fixes that by introducing
BaseEvent.is_allowed(...)method which callsBaseHandler.allow_build()with all the attributes particular Event provides. Therefore the list of attributes are in single file in the particular Event's class.