Improve .boto message visibility

An out of date .boto file can prevent Google employees from being able
to download the Chromium toolchain from Google storage. An error message
was added to gsutil.py to help developers diagnose this, but the message
was swallowed by get_toolchain_if_necessary.py. This change prints the
error message, and adds '*' * 80 separators to make it more visible.

An obsolete import is also removed.

Bug: 1414152
Change-Id: I69d5a786672304ed363c291e0a8ef89f8be0f2e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4310059
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/59/4310059/3
Bruce Dawson 2 years ago committed by LUCI CQ
parent 6376f90dc5
commit 04206434e7

@ -260,10 +260,13 @@ def run_gsutil(target, args, clean=False):
# Notify user that their .boto file might be outdated.
if b'Your credentials are invalid.' in p.stderr:
# Make sure this error message is visible when invoked by gclient runhooks
separator = '*' * 80
print(
'\n' + separator + '\n' +
'Warning: You might have an outdated .boto file. If this issue '
'persists after running `gsutil.py config`, try removing your '
'.boto file.',
'.boto file.\n' + separator + '\n',
file=sys.stderr)
_print_subprocess_result(p)

@ -26,7 +26,6 @@ import hashlib
import filecmp
import json
import os
import platform
import shutil
import subprocess
import sys
@ -257,7 +256,11 @@ def CanAccessToolchainBucket():
"""Checks whether the user has access to gs://chrome-wintoolchain/."""
gsutil = download_from_google_storage.Gsutil(
download_from_google_storage.GSUTIL_DEFAULT_PATH, boto_path=None)
code, _, _ = gsutil.check_call('ls', 'gs://chrome-wintoolchain/')
code, stdout, stderr = gsutil.check_call('ls', 'gs://chrome-wintoolchain/')
if code != 0:
# Make sure any error messages are made visible to the user.
print(stderr, file=sys.stderr, end='')
print(stdout, end='')
return code == 0

Loading…
Cancel
Save