Add method to recover status of a flag in _meta

This commit is contained in:
Alberto Planas 2015-08-28 14:49:15 +02:00
parent 3daf64078a
commit f0cb13e9b9

View File

@ -879,6 +879,17 @@ class StagingAPI(object):
self.do_change_review_state(request_id, state, by_project=project,
message=msg)
def get_flag_in_prj(self, project, flag='build', repository=None, arch=None):
"""Return the flag value in a project."""
url = self.makeurl(['source', project, '_meta'])
root = ET.parse(http_GET(url)).getroot()
section = root.find(flag)
for status in section:
is_repository = status.get('repository', None) == repository
is_arch = status.get('arch', None) == arch
if is_repository and is_arch:
return status.tag
def switch_flag_in_prj(self, project, flag='build', state='disable', repository=None, arch=None):
url = self.makeurl(['source', project, '_meta'])
prjmeta = ET.parse(http_GET(url)).getroot()