mirror of https://github.com/databricks/cli.git
allow no OAuth in case PAT is used
This commit is contained in:
parent
6a8b2f452f
commit
6277cf24c6
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
|
||||||
|
"github.com/databricks/cli/libs/auth/cache"
|
||||||
"github.com/databricks/cli/libs/auth"
|
"github.com/databricks/cli/libs/auth"
|
||||||
"github.com/databricks/cli/libs/cmdio"
|
"github.com/databricks/cli/libs/cmdio"
|
||||||
"github.com/databricks/cli/libs/databrickscfg"
|
"github.com/databricks/cli/libs/databrickscfg"
|
||||||
|
@ -98,8 +99,14 @@ func newLogoutCommand(persistentAuth *auth.PersistentAuth) *cobra.Command {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := LogoutSession.clearTokenCache(ctx); err != nil {
|
err = LogoutSession.clearTokenCache(ctx)
|
||||||
return err
|
if err != nil {
|
||||||
|
if errors.Is(err, cache.ErrNotConfigured) {
|
||||||
|
// It is OK to not have OAuth configured. Move on and remove
|
||||||
|
// sensitive values example PAT from config file
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := LogoutSession.clearConfigFile(ctx, configSectionMap); err != nil {
|
if err := LogoutSession.clearConfigFile(ctx, configSectionMap); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue