From 7da5500311749071e367fbbcdc1fb9c1e4748d77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= <lorenz.huedepohl@rzg.mpg.de>
Date: Mon, 19 Nov 2018 18:57:33 +0100
Subject: [PATCH] Make not accepting the request an exception exit

---
 mpcdf_push.py | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/mpcdf_push.py b/mpcdf_push.py
index c79dd82..6b3fb67 100644
--- a/mpcdf_push.py
+++ b/mpcdf_push.py
@@ -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))
     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("Do you want to accept the request right away? [y/N] ", end="")
-        response = input().lower()
-        if response == "y":
-            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("Press Ctrl-C to abort, any key to continue", end="")
+        input()
+        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)
 
         user = osc.conf.get_apiurl_usr(api_url)
         if user not in existing_maintainers:
@@ -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.description = "Add user {0} as maintainer due to 'osc mpcdf_push'".format(user)
             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'")
-                print("  Accepting request {0}:".format(r.reqid), result)
+            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()
 
     # Give the system some time, sadly there is no transactional guarantee
-- 
GitLab