From d2fdba4e78d39e4f80b01a6498e1dca58e9c66fe Mon Sep 17 00:00:00 2001 From: Allen Li Date: Wed, 4 Dec 2024 01:49:36 +0000 Subject: [PATCH] Improve printed info in git cl creds-check May help user to diagnose/debug some issues. Bug: b/372552465 Change-Id: Ia9fc4fd49c8ee80bccd98442ed5589324d0b23b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6068966 Reviewed-by: Gavin Mak Auto-Submit: Allen Li Commit-Queue: Allen Li --- git_cl.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/git_cl.py b/git_cl.py index 1e1e88821..12f769af4 100755 --- a/git_cl.py +++ b/git_cl.py @@ -3888,17 +3888,23 @@ def CMDcreds_check(parser, args): if newauth.Enabled(): cl = Changelist() + host = cl.GetGerritHost() + print(f'Using Gerrit host: {host!r}') git_auth.Configure(os.getcwd(), cl) # Perform some advisory checks email = scm.GIT.GetConfig(os.getcwd(), 'user.email') or '' - if not gerrit_util.ShouldUseSSO(cl.GetGerritHost(), email): + print(f'Using email (configured in Git): {email!r}') + if gerrit_util.ShouldUseSSO(host, email): + print('Detected that we should be using SSO.') + else: + print('Detected that we should be using luci-auth.') a = gerrit_util.LuciAuthAuthenticator() try: a.luci_auth.get_access_token() except auth.LoginRequiredError as e: print('NOTE: You are not logged in with luci-auth.') print( - 'You may not be able to perform some actions without logging in.' + 'You will not be able to perform many actions without logging in.' ) print('If you wish to log in, run:') print(' ' + e.login_command)