mirror of https://github.com/databricks/cli.git
handle edge case
This commit is contained in:
parent
f9675ab8ea
commit
517e1b3310
|
@ -46,9 +46,10 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var ( // Databricks SDK API: `databricks OAuth is not` will be checked for presence
|
var ( // Databricks SDK API: `databricks OAuth is not` will be checked for presence
|
||||||
ErrOAuthNotSupported = errors.New("databricks OAuth is not supported for this host")
|
ErrOAuthNotSupported = errors.New("databricks OAuth is not supported for this host")
|
||||||
ErrNotConfigured = errors.New("databricks OAuth is not configured for this host")
|
ErrNotConfigured = errors.New("databricks OAuth is not configured for this host")
|
||||||
ErrFetchCredentials = errors.New("cannot fetch credentials")
|
ErrFetchCredentials = errors.New("cannot fetch credentials")
|
||||||
|
ErrDeviceCodeNotSupported = errors.New("device code flow is not supported for this host")
|
||||||
)
|
)
|
||||||
|
|
||||||
type PersistentAuth struct {
|
type PersistentAuth struct {
|
||||||
|
@ -129,6 +130,9 @@ func (a *PersistentAuth) DeviceCode(ctx context.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if cfg.Endpoint.DeviceAuthURL == "" {
|
||||||
|
return ErrDeviceCodeNotSupported
|
||||||
|
}
|
||||||
ctx = a.http.InContextForOAuth2(ctx)
|
ctx = a.http.InContextForOAuth2(ctx)
|
||||||
deviceAuthResp, err := cfg.DeviceAuth(ctx)
|
deviceAuthResp, err := cfg.DeviceAuth(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue