Skip to content

Commit b1cf990

Browse files
mtodzoMuweiHeBrian Strauch
authored
[CLI-1635] Add SR client logging and log SSO error (#1200)
* initial logging * use sr client debug option * Update internal/cmd/schema-registry/credentials.go Co-authored-by: Brian Strauch <bstrauch@confluent.io> * Update internal/pkg/auth/auth_token_handler.go Co-authored-by: Brian Strauch <bstrauch@confluent.io> Co-authored-by: MuweiHe <83249359+MuweiHe@users.noreply.github.com> Co-authored-by: Brian Strauch <bstrauch@confluent.io>
1 parent 6f72acf commit b1cf990

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/confluentinc/mds-sdk-go/mdsv1 v0.0.40
2828
github.com/confluentinc/mds-sdk-go/mdsv2alpha1 v0.0.40
2929
github.com/confluentinc/properties v0.0.0-20190814194548-42c10394a787
30-
github.com/confluentinc/schema-registry-sdk-go v0.0.12
30+
github.com/confluentinc/schema-registry-sdk-go v0.0.13
3131
github.com/davecgh/go-spew v1.1.1
3232
github.com/dghubble/sling v1.4.0
3333
github.com/fatih/color v1.13.0

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ github.com/confluentinc/proto-go-setter v0.0.0-20201026155413-c6ceb267ee65/go.mo
675675
github.com/confluentinc/protoc-gen-ccloud v0.0.4 h1:cQkU/EJe1ZeSMNyIr2EZkcyJx4rhhR5v7Ierj3toxbo=
676676
github.com/confluentinc/protoc-gen-ccloud v0.0.4/go.mod h1:c5l+BPASYdK6SttAYW8yrGx0NNhB+4xpKID+w/MXp/8=
677677
github.com/confluentinc/prototools v0.0.4/go.mod h1:V4b4Enz2JM192RaRXFyN3yBMXAToleg+dTpCOu4fnhE=
678-
github.com/confluentinc/schema-registry-sdk-go v0.0.12 h1:cAbyMjl+osUwTlYipSG2XcMSrvcugBOK0JdVznfdUKg=
679-
github.com/confluentinc/schema-registry-sdk-go v0.0.12/go.mod h1:+3hPLr84tBmDdQV1XSvo3H9FZwL3+Nx9MGbm17QyXq0=
678+
github.com/confluentinc/schema-registry-sdk-go v0.0.13 h1:5aFdsOpbKwzIqnwnhQ5cNwjulTPAeV/u6mu0xh/Sqck=
679+
github.com/confluentinc/schema-registry-sdk-go v0.0.13/go.mod h1:rz5jgOSmMgeVGCzqsI01SdpmGtkb1nFYtfh67SyzZL4=
680680
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
681681
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw=
682682
github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
@@ -2426,7 +2426,6 @@ golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba/go.mod h1:N/0e6XlmueqKjAG
24262426
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
24272427
golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
24282428
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
2429-
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
24302429
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
24312430
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
24322431
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

internal/cmd/schema-registry/credentials.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package schemaregistry
22

33
import (
44
"context"
5+
"github.com/confluentinc/cli/internal/pkg/log"
56
"os"
67

78
srsdk "github.com/confluentinc/schema-registry-sdk-go"
@@ -50,6 +51,7 @@ func getSchemaRegistryAuth(cmd *cobra.Command, srCredentials *v1.APIKeyPair, sho
5051

5152
func getSchemaRegistryClient(cmd *cobra.Command, cfg *pcmd.DynamicConfig, ver *version.Version, srAPIKey, srAPISecret string) (*srsdk.APIClient, context.Context, error) {
5253
srConfig := srsdk.NewConfiguration()
54+
srConfig.Debug = log.CliLogger.GetLevel() >= log.DEBUG
5355

5456
ctx := cfg.Context()
5557

@@ -58,6 +60,7 @@ func getSchemaRegistryClient(cmd *cobra.Command, cfg *pcmd.DynamicConfig, ver *v
5860
if len(endpoint) == 0 {
5961
cluster, err := ctx.SchemaRegistryCluster(cmd)
6062
if err != nil {
63+
log.CliLogger.Debug("failed to find active schema registry cluster")
6164
return nil, nil, err
6265
}
6366
srCluster = cluster

internal/pkg/auth/auth_token_handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (a *AuthTokenHandlerImpl) GetCCloudTokens(clientFactory CCloudClientFactory
5757
func (a *AuthTokenHandlerImpl) getCCloudSSOToken(client *ccloud.Client, noBrowser bool, email, orgResourceId string) (string, string, error) {
5858
userSSO, err := a.getCCloudUserSSO(client, email, orgResourceId)
5959
if err != nil {
60+
log.CliLogger.Debugf("unable to obtain user SSO info: %v", err)
6061
return "", "", errors.Errorf(errors.FailedToObtainedUserSSOErrorMsg, email)
6162
}
6263
if userSSO == "" {

0 commit comments

Comments
 (0)