Move config into an OBS attribute
Right now we require a Staging subproject to use staging plugin, which is suboptimal especially for maintenance requests. The OBS attributes allow to store the things right attached to the project - and the permissions can be controlled in parallel to the maintainers right, which gives us enough freedom
This commit is contained in:
parent
3f7ae41a10
commit
030e7b807f
@ -249,7 +249,7 @@ class Config(object):
|
||||
if not conf.config[self.project].get('remote-config', True):
|
||||
return
|
||||
|
||||
config = api.dashboard_content_load('config')
|
||||
config = None # api.dashboard_content_load('config')
|
||||
if config:
|
||||
cp = ConfigParser()
|
||||
config = '[remote]\n' + config
|
||||
|
@ -851,7 +851,8 @@ class StagingAPI(object):
|
||||
if self._supersede:
|
||||
self.is_package_disabled(sub_prj, sub_pkg, store=True)
|
||||
# Skip inner-project links for letter staging
|
||||
if not self.is_adi_project(project) and sub_prj == project: continue
|
||||
if not self.is_adi_project(project) and sub_prj == project:
|
||||
continue
|
||||
delete_package(self.apiurl, sub_prj, sub_pkg, force=True, msg=msg)
|
||||
|
||||
# Delete the main package in the last
|
||||
@ -1261,7 +1262,8 @@ class StagingAPI(object):
|
||||
for sub_prj, sub_pkg in self.get_sub_packages(tar_pkg, project):
|
||||
sub_prj = self.map_ring_package_to_subject(project, sub_pkg)
|
||||
# Skip inner-project links for letter staging
|
||||
if not self.is_adi_project(project) and sub_prj == project: continue
|
||||
if not self.is_adi_project(project) and sub_prj == project:
|
||||
continue
|
||||
if self._supersede:
|
||||
disable_build = self._package_disabled.get('/'.join([sub_prj, sub_pkg]), False)
|
||||
self.create_package_container(sub_prj, sub_pkg, disable_build=disable_build)
|
||||
@ -1530,6 +1532,31 @@ class StagingAPI(object):
|
||||
if content != self.dashboard_content_load(filename):
|
||||
self.dashboard_content_save(filename, content, comment)
|
||||
|
||||
def attribute_value_load(self, attribute):
|
||||
url = self.makeurl(['source', self.project, '_attribute', 'OSRT:' + attribute])
|
||||
f = self.retried_GET(url)
|
||||
root = ET.parse(f).getroot()
|
||||
root = root.find('./attribute/value')
|
||||
if root is None:
|
||||
return None
|
||||
return root.text
|
||||
|
||||
# to create a new attribute 'type' you need to do some manual step
|
||||
# create a xml file analoge to what
|
||||
# osc api /attribute/OSRT/IgnoredIssues/_meta outputs
|
||||
# you need to think about roles, groups and users that should be
|
||||
# able to write the attribute
|
||||
# after that osc api -T $xml /attribute/OSRT/$NEWATTRIBUTE/_meta
|
||||
# (preferably do this right away for ibs and obs)
|
||||
def attribute_value_save(self, attribute, text):
|
||||
root = ET.fromstring('<attributes><attribute name="" namespace="OSRT">' +
|
||||
'<value/></attribute></attributes>'.format(attribute))
|
||||
root.find('./attribute').set('name', attribute)
|
||||
root.find('./attribute/value').text = text
|
||||
# the OBS API of attributes is super strange, you POST updates
|
||||
url = self.makeurl(['source', self.project, '_attribute'])
|
||||
self.retried_POST(url, data=ET.tostring(root))
|
||||
|
||||
def update_status_or_deactivate(self, project, command):
|
||||
meta = self.get_prj_pseudometa(project)
|
||||
if len(meta['requests']) == 0:
|
||||
@ -1686,7 +1713,6 @@ class StagingAPI(object):
|
||||
except:
|
||||
print "could not trigger rebuild for project '%s' package '%s'" % (prj, pkg)
|
||||
|
||||
|
||||
def _candidate_adi_project(self):
|
||||
"""Decide a candidate name for an ADI project."""
|
||||
adi_projects = self.get_adi_projects()
|
||||
|
@ -71,12 +71,9 @@ class ToTestBase(object):
|
||||
self.amqp_url = osc.conf.config.get('ttm_amqp_url')
|
||||
|
||||
def load_issues_to_ignore(self):
|
||||
url = self.api.makeurl(['source', self.project, '_attribute', 'OSRT:IgnoredIssues'])
|
||||
f = self.api.retried_GET(url)
|
||||
root = ET.parse(f).getroot()
|
||||
root = root.find('./attribute/value')
|
||||
if root is not None:
|
||||
root = yaml.load(root.text)
|
||||
text = self.api.attribute_value_load('IgnoredIssues')
|
||||
if text:
|
||||
root = yaml.load(text)
|
||||
self.issues_to_ignore = root.get('last_seen')
|
||||
else:
|
||||
self.issues_to_ignore = dict()
|
||||
@ -85,11 +82,7 @@ class ToTestBase(object):
|
||||
if self.dryrun:
|
||||
return
|
||||
text = yaml.dump({'last_seen': self.issues_to_ignore}, default_flow_style=False)
|
||||
root = ET.fromstring('<attributes><attribute name="IgnoredIssues" namespace="OSRT">' +
|
||||
'<value/></attribute></attributes>')
|
||||
root.find('./attribute/value').text = text
|
||||
url = self.api.makeurl(['source', self.project, '_attribute'])
|
||||
self.api.retried_POST(url, data=ET.tostring(root))
|
||||
self.api.attribute_value_save('IgnoredIssues', text)
|
||||
|
||||
def openqa_group(self):
|
||||
return self.project
|
||||
|
Loading…
x
Reference in New Issue
Block a user