osclib/core: request_action_list_maintenance_incident(): support another form.

When at last one thought all the variations of the data format were
handled OBS decided to provide another. :((((
This commit is contained in:
Jimmy Berry 2019-11-07 10:59:21 -06:00
parent a3b1d627b4
commit c6e093d8d0

View File

@ -911,7 +911,15 @@ def request_action_list_maintenance_incident(apiurl, project, package, states=['
# Before being assigned to an incident. # Before being assigned to an incident.
xpath_project = xpath_join(xpath_project, 'action/target/@project="{}"'.format( xpath_project = xpath_join(xpath_project, 'action/target/@project="{}"'.format(
maintenance_project)) maintenance_project))
xpath_project = xpath_join(xpath_project, 'action/source/@package="{}"'.format(package), op='and', inner=True)
xpath_project_package = ''
xpath_project_package = xpath_join(
xpath_project_package, 'action/source/@package="{}"'.format(package))
xpath_project_package = xpath_join(
xpath_project_package, 'action/source/@package="{}"'.format(
package_repository), op='or', inner=True)
xpath_project = xpath_join(xpath_project, f'({xpath_project_package})', op='and', inner=True)
xpath = xpath_join(xpath, xpath_project, op='or', nexpr_parentheses=True) xpath = xpath_join(xpath, xpath_project, op='or', nexpr_parentheses=True)
xpath_project = '' xpath_project = ''
@ -941,7 +949,8 @@ def request_action_list_maintenance_incident(apiurl, project, package, states=['
for action in request.actions: for action in request.actions:
if action.type == 'maintenance_incident' and action.tgt_releaseproject == project and ( if action.type == 'maintenance_incident' and action.tgt_releaseproject == project and (
(action.tgt_package is None and action.src_package == package) or (action.tgt_package is None and
(action.src_package == package or action.src_package == package_repository)) or
(action.tgt_package == package_repository)): (action.tgt_package == package_repository)):
yield request, action yield request, action
break break