Merge pull request #1759 from jberry-suse/request-splitter-stageable

osclib/request_splitter: provide stageable option and make default True.
This commit is contained in:
Jimmy Berry 2018-11-01 13:38:43 -05:00 committed by GitHub
commit 33a4a3b348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -29,7 +29,6 @@ class ListCommand:
if not len(requests): return
splitter = RequestSplitter(self.api, requests, in_ring=True)
splitter.filter_add('./action[@type="submit" or @type="delete"]')
splitter.group_by('./action/target/@devel_project')
splitter.split()
@ -68,6 +67,7 @@ class ListCommand:
print 'Not in a ring:', ' '.join(sorted(non_ring_packages))
# Print requests not handled by staging process to highlight them.
splitter.stageable = False
for request_type in ('change_devel', 'set_bugowner'):
splitter.reset()
splitter.filter_add('./action[@type="{}"]'.format(request_type))

View File

@ -9,10 +9,11 @@ from osclib.core import request_age
import re
class RequestSplitter(object):
def __init__(self, api, requests, in_ring):
def __init__(self, api, requests, in_ring, stageable=True):
self.api = api
self.requests = requests
self.in_ring = in_ring
self.stageable = stageable
self.config = conf.config[self.api.project]
# 55 minutes to avoid two staging bot loops of 30 minutes
@ -38,6 +39,10 @@ class RequestSplitter(object):
self.other = []
self.grouped = {}
if self.stageable:
# Require requests to be stageable (submit or delete package).
self.filter_add('./action[@type="submit" or (@type="delete" and ./target[@package])]')
def strategy_set(self, name, **kwargs):
self.reset()
@ -393,7 +398,6 @@ class Strategy(object):
class StrategyNone(Strategy):
def apply(self, splitter):
splitter.filter_add('./action[not(@type="add_role" or @type="change_devel")]')
# All other strategies that inherit this are not restricted by age as
# the age restriction is used to allow other strategies to be observed.
if type(self) is StrategyNone: