From deb062c48996c90b39bc12fa76824e66a532b69f Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 29 Nov 2023 14:29:17 +0100 Subject: [PATCH] Fix bug where the account or workspace client could be `nil` (#1020) ## Changes We didn't return the error upon creating a workspace or account client. If there is an error, it must always propagate up the stack. The result of this bug was that we were setting a `nil` account or workspace client, which in turn caused SIGSEGVs. Fixes #913. ## Tests Manually confirmed this fixes the linked issue. The CLI now correctly returns an error when the client cannot be constructed. The issue was reproducible using a `.databrickscfg` with a single, incorrectly configured profile. --- cmd/root/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root/auth.go b/cmd/root/auth.go index 350cbc65..99e91043 100644 --- a/cmd/root/auth.go +++ b/cmd/root/auth.go @@ -65,7 +65,7 @@ func accountClientOrPrompt(ctx context.Context, cfg *config.Config, allowPrompt return nil, err } } - return a, nil + return a, err } func MustAccountClient(cmd *cobra.Command, args []string) error { @@ -133,7 +133,7 @@ func workspaceClientOrPrompt(ctx context.Context, cfg *config.Config, allowPromp return nil, err } } - return w, nil + return w, err } func MustWorkspaceClient(cmd *cobra.Command, args []string) error {