Skip to content
Snippets Groups Projects
Commit 7da55003 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Make not accepting the request an exception exit

parent a0434218
No related branches found
No related tags found
No related merge requests found
...@@ -85,11 +85,10 @@ def do_mpcdf_push(self, subcmd, opts, *args): ...@@ -85,11 +85,10 @@ def do_mpcdf_push(self, subcmd, opts, *args):
print("Submitted package {0} to {1} in request {2}".format(package, to_project, req_id)) print("Submitted package {0} to {1} in request {2}".format(package, to_project, req_id))
if not opts.batch: if not opts.batch:
print("\nPLEASE review the request by 'osc request show {0} --diff', or in the web interface\n".format(req_id)) print("\nPLEASE review the request by 'osc request show {0} --diff', or in the web interface\n".format(req_id))
print("Do you want to accept the request right away? [y/N] ", end="") print("Press Ctrl-C to abort, any key to continue", end="")
response = input().lower() input()
if response == "y": result = osc.core.change_request_state(api_url, req_id, 'accepted', "Accepted on the command line via 'osc mpcdf_push'")
result = osc.core.change_request_state(api_url, req_id, 'accepted', "Accepted on the command line via 'osc mpcdf_push'") print(" Accepting request {0}:".format(req_id), result)
print(" Accepting request {0}:".format(req_id), result)
user = osc.conf.get_apiurl_usr(api_url) user = osc.conf.get_apiurl_usr(api_url)
if user not in existing_maintainers: if user not in existing_maintainers:
...@@ -98,9 +97,8 @@ def do_mpcdf_push(self, subcmd, opts, *args): ...@@ -98,9 +97,8 @@ def do_mpcdf_push(self, subcmd, opts, *args):
r.add_action("add_role", tgt_project=to_project, tgt_package=package, person_name=user, person_role="maintainer") r.add_action("add_role", tgt_project=to_project, tgt_package=package, person_name=user, person_role="maintainer")
r.description = "Add user {0} as maintainer due to 'osc mpcdf_push'".format(user) r.description = "Add user {0} as maintainer due to 'osc mpcdf_push'".format(user)
r.create(api_url) r.create(api_url)
if response == "y": result = osc.core.change_request_state(api_url, r.reqid, 'accepted', "Accepted on the command line via 'osc mpcdf_push'")
result = osc.core.change_request_state(api_url, r.reqid, 'accepted', "Accepted on the command line via 'osc mpcdf_push'") print(" Accepting request {0}:".format(r.reqid), result)
print(" Accepting request {0}:".format(r.reqid), result)
print() print()
# Give the system some time, sadly there is no transactional guarantee # Give the system some time, sadly there is no transactional guarantee
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment