mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-12 02:04:04 +02:00
automatic fallback to maintenance request
alternative would be to raise exception and have calling code implement the fallback
This commit is contained in:
@@ -3495,14 +3495,13 @@ def create_submit_request(apiurl,
|
|||||||
r = root.get('id')
|
r = root.get('id')
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
if e.headers.get('X-Opensuse-Errorcode') == "submit_request_rejected":
|
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]"
|
print "Project does not accept submit request, trying fallback to maintenance request ..."
|
||||||
if sys.stdin.read(1) == "y":
|
|
||||||
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
|
xpath = 'maintenance/maintains/@project = \'%s\'' % dst_project
|
||||||
res = search(apiurl, project_id=xpath)
|
res = search(apiurl, project_id=xpath)
|
||||||
root = res['project_id']
|
root = res['project_id']
|
||||||
project = root.find('project')
|
project = root.find('project')
|
||||||
if project is None:
|
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')
|
tproject = project.get('name')
|
||||||
r = create_maintenance_request(apiurl, src_project, [src_package], tproject, dst_project, src_update, message)
|
r = create_maintenance_request(apiurl, src_project, [src_package], tproject, dst_project, src_update, message)
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user