From 331a276b54282b46381c1c0aff7f4a26afbb21ae Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Tue, 14 Nov 2017 10:32:58 -0800 Subject: [PATCH] bot_update: make --output_json required in script invocation. It's already set by recipe, so this should have 0 difference in prod. R=iannucci@chromium.org Bug: Change-Id: I1e1129b9748d6647e45eb26892c8e892019fe088 Reviewed-on: https://chromium-review.googlesource.com/769164 Reviewed-by: Robbie Iannucci Commit-Queue: Andrii Shyshkalov --- .../bot_update/resources/bot_update.py | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 12453b615..a0097fa94 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -1003,7 +1003,7 @@ def parse_args(): help=('Deprecated.')) parse.add_option('--clobber', action='store_true', help='Delete checkout first, always') - parse.add_option('--output_json', + parse.add_option('--output_json', required=True, help='Output JSON information into a specified file') parse.add_option('--no_shallow', action='store_true', help='Bypass disk detection and never shallow clone. ' @@ -1085,8 +1085,6 @@ def prepare(options, git_slns, active): step_text = '[%dGB/%dGB used (%d%%)]' % (used_disk_space_gb, total_disk_space_gb, percent_used) - if not options.output_json: - print '@@@STEP_TEXT@%s@@@' % step_text shallow = (total_disk_space < SHALLOW_CLONE_THRESHOLD and not options.no_shallow) @@ -1148,17 +1146,16 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow): ensure_no_checkout(dir_names, options.cleanup_dir) gclient_output = ensure_checkout(**checkout_parameters) except PatchFailed as e: - if options.output_json: - # Tell recipes information such as root, got_revision, etc. - emit_json(options.output_json, - did_run=True, - root=first_sln, - patch_apply_return_code=e.code, - patch_root=options.patch_root, - patch_failure=True, - failed_patch_body=e.output, - step_text='%s PATCH FAILED' % step_text, - fixed_revisions=revisions) + # Tell recipes information such as root, got_revision, etc. + emit_json(options.output_json, + did_run=True, + root=first_sln, + patch_apply_return_code=e.code, + patch_root=options.patch_root, + patch_failure=True, + failed_patch_body=e.output, + step_text='%s PATCH FAILED' % step_text, + fixed_revisions=revisions) raise # Take care of got_revisions outputs. @@ -1181,18 +1178,17 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow): got_revisions = { 'got_revision': 'BOT_UPDATE_NO_REV_FOUND' } #raise Exception('No got_revision(s) found in gclient output') - if options.output_json: - # Tell recipes information such as root, got_revision, etc. - emit_json(options.output_json, - did_run=True, - root=first_sln, - patch_root=options.patch_root, - step_text=step_text, - fixed_revisions=revisions, - properties=got_revisions, - manifest=create_manifest_old(), - source_manifest=create_manifest( - gclient_output, options.patch_root, options.gerrit_ref)) + # Tell recipes information such as root, got_revision, etc. + emit_json(options.output_json, + did_run=True, + root=first_sln, + patch_root=options.patch_root, + step_text=step_text, + fixed_revisions=revisions, + properties=got_revisions, + manifest=create_manifest_old(), + source_manifest=create_manifest( + gclient_output, options.patch_root, options.gerrit_ref)) def print_debug_info():