mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46: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
@ -3495,14 +3495,13 @@ 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":
|
||||
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:
|
||||
sys.exit('No maintenance project defined for target project on server.')
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user