mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 17:36:13 +01:00
automatic fallback to maintenance request
alternative would be to raise exception and have calling code implement the fallback
This commit is contained in:
parent
0cdc695c21
commit
b6069c6946
21
osc/core.py
21
osc/core.py
@ -3495,18 +3495,17 @@ def create_submit_request(apiurl,
|
||||
r = root.get('id')
|
||||
except urllib2.HTTPError, e:
|
||||
if e.headers.get('X-Opensuse-Errorcode') == "submit_request_rejected":
|
||||
print "This project is just for releasing maintenance updates. Do you want to create a maintenance incident request instead? [y/n]"
|
||||
if sys.stdin.read(1) == "y":
|
||||
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
|
||||
res = search(apiurl, project_id=xpath)
|
||||
root = res['project_id']
|
||||
project = root.find('project')
|
||||
if project is None:
|
||||
sys.exit('No maintenance project defined for target project on server.')
|
||||
tproject = project.get('name')
|
||||
r = create_maintenance_request(apiurl, src_project, [src_package], tproject, dst_project, src_update, message)
|
||||
print "Project does not accept submit request, trying fallback to maintenance request ..."
|
||||
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
|
||||
res = search(apiurl, project_id=xpath)
|
||||
root = res['project_id']
|
||||
project = root.find('project')
|
||||
if project is None:
|
||||
raise oscerr.APIError("Server did not define a maintenance project, can't submit.")
|
||||
tproject = project.get('name')
|
||||
r = create_maintenance_request(apiurl, src_project, [src_package], tproject, dst_project, src_update, message)
|
||||
else:
|
||||
raise
|
||||
raise
|
||||
|
||||
return r
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user