request_splitter: add staging whitelist config option.

For the initial Factory usage the bot will be allowed to stage on a subset
of the available stagings.
This commit is contained in:
Jimmy Berry 2017-04-28 15:42:09 -05:00
parent 516a99cb5a
commit 7f9cc0f74c
2 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,7 @@ DEFAULT = {
'openqa': 'https://openqa.opensuse.org', 'openqa': 'https://openqa.opensuse.org',
'lock': 'openSUSE:%(project)s:Staging', 'lock': 'openSUSE:%(project)s:Staging',
'lock-ns': 'openSUSE', 'lock-ns': 'openSUSE',
'splitter-whitelist': 'B C D E F G',
}, },
r'openSUSE:(?P<project>Leap:[\d.]+)': { r'openSUSE:(?P<project>Leap:[\d.]+)': {
'staging': 'openSUSE:%(project)s:Staging', 'staging': 'openSUSE:%(project)s:Staging',

View File

@ -2,6 +2,7 @@ from datetime import datetime
import dateutil.parser import dateutil.parser
import hashlib import hashlib
from lxml import etree as ET from lxml import etree as ET
from osc import conf
import re import re
class RequestSplitter(object): class RequestSplitter(object):
@ -202,6 +203,10 @@ class RequestSplitter(object):
# Use specified list of stagings, otherwise only empty, letter stagings. # Use specified list of stagings, otherwise only empty, letter stagings.
if len(stagings) == 0: if len(stagings) == 0:
whitelist = conf.config[self.api.project].get('splitter-whitelist')
if whitelist:
stagings = whitelist.split()
else:
stagings = self.api.get_staging_projects_short() stagings = self.api.get_staging_projects_short()
should_always = False should_always = False
else: else: