You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2018/09/15 10:35:03 UTC

[mesos] branch master updated: Fixed `verify-reviews.py` script to make `-o` optional.

This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 43eba28  Fixed `verify-reviews.py` script to make `-o` optional.
43eba28 is described below

commit 43eba285cb5c8622a6be8a5bdad637ed53431e85
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
AuthorDate: Sat Sep 15 12:29:48 2018 +0200

    Fixed `verify-reviews.py` script to make `-o` optional.
    
    The semantics changed when the ReviewBot scripts were upstreamed; this
    makes the `out_file` parameter optional, writing to stdout if not set.
    
    Review: https://reviews.apache.org/r/68723/
---
 support/verify-reviews.py | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/support/verify-reviews.py b/support/verify-reviews.py
index ce9a359..72b7eb5 100755
--- a/support/verify-reviews.py
+++ b/support/verify-reviews.py
@@ -77,15 +77,9 @@ def parse_parameters():
                              " format. Example: '%s'" % json.dumps(
                                  default_query),
                         default=json.dumps(default_query))
-
-    subparsers = parser.add_subparsers(title="The script plug-in type")
-
-    file_parser = subparsers.add_parser(
-        "file", description="File plug-in just writes to a file all"
-                            " the review ids that need verification")
-    file_parser.add_argument("-o", "--out-file", type=str, required=True,
-                             help="The out file with the reviews IDs that"
-                                  " need verification")
+    parser.add_argument("-o", "--out-file", type=str, required=False,
+                        help="The out file with the reviews IDs that"
+                             " need verification")
 
     return parser.parse_args()
 
@@ -244,14 +238,11 @@ def verification_needed_write(review_ids, parameters):
     """Write the IDs of the review requests that need verification."""
     num_reviews = len(review_ids)
     print("%s review requests need verification" % num_reviews)
-    # out_file parameter is mandatory to be passed
-    try:
-        # Using file plug-in
+    if parameters.out_file is not None:
         with open(parameters.out_file, 'w') as f:
             f.write('\n'.join(review_ids))
-    except Exception:
-        print("Failed opening file '%s' for writing" % parameters.out_file)
-        raise
+    else:
+        print('\n'.join(review_ids))
 
 
 def main():