Commit f6b414c5 authored by Gavin Mak's avatar Gavin Mak Committed by LUCI CQ

Add client not configured message to gclient validate and flatten

Running gclient validate or gclient flatten outside of gclient root
results in an unhelpful AttributeError stacktrace. This change adds an
error message that lets the user know the client is not confugred.

Bug: 732733
Change-Id: I33b1a08aa394145e238a4939bfd995ec33a8df17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2624351Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
parent 59b0ce20
......@@ -2273,6 +2273,8 @@ def CMDflatten(parser, args):
options.nohooks = True
options.process_all_deps = True
client = GClient.LoadCurrentConfig(options)
if not client:
raise gclient_utils.Error('client not configured; see \'gclient config\'')
# Only print progress if we're writing to a file. Otherwise, progress updates
# could obscure intended output.
......@@ -2758,6 +2760,8 @@ def CMDvalidate(parser, args):
"""Validates the .gclient and DEPS syntax."""
options, args = parser.parse_args(args)
client = GClient.LoadCurrentConfig(options)
if not client:
raise gclient_utils.Error('client not configured; see \'gclient config\'')
rv = client.RunOnDeps('validate', args)
if rv == 0:
print('validate: SUCCESS')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment