Skip to content

Commit

Permalink
cfgpickers
Browse files Browse the repository at this point in the history
  • Loading branch information
nfx committed Nov 9, 2023
1 parent 321f908 commit 5819644
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 235 deletions.
4 changes: 2 additions & 2 deletions cmd/labs/project/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/databricks/cli/cmd/labs/github"
"github.com/databricks/cli/cmd/labs/unpack"
"github.com/databricks/cli/cmd/workspace/clusters"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/databrickscfg"
"github.com/databricks/cli/libs/databrickscfg/cfgpickers"
"github.com/databricks/cli/libs/log"
"github.com/databricks/cli/libs/process"
"github.com/databricks/cli/libs/python"
Expand Down Expand Up @@ -238,7 +238,7 @@ func (i *installer) setupPythonVirtualEnvironment(ctx context.Context, w *databr
if err != nil {
return fmt.Errorf("cluster: %w", err)
}
runtimeVersion, ok := clusters.GetRuntimeVersion(cluster)
runtimeVersion, ok := cfgpickers.GetRuntimeVersion(*cluster)
if !ok {
return fmt.Errorf("unsupported runtime: %s", cluster.SparkVersion)
}
Expand Down
9 changes: 5 additions & 4 deletions cmd/labs/project/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"os"

"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/cmd/workspace/clusters"
"github.com/databricks/cli/cmd/workspace/warehouses"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/databrickscfg/cfgpickers"
"github.com/databricks/cli/libs/log"
"github.com/databricks/databricks-sdk-go"
"github.com/databricks/databricks-sdk-go/config"
Expand Down Expand Up @@ -70,7 +69,8 @@ func (lc *loginConfig) askCluster(ctx context.Context, w *databricks.WorkspaceCl
if !cmdio.IsInteractive(ctx) {
return ErrNotInTTY
}
clusterID, err := clusters.AskForCompatibleCluster(ctx, w, lc.Installer.MinRuntimeVersion)
clusterID, err := cfgpickers.AskForCluster(ctx, w,
cfgpickers.WithDatabricksConnect(lc.Installer.MinRuntimeVersion))
if err != nil {
return fmt.Errorf("select: %w", err)
}
Expand All @@ -90,7 +90,8 @@ func (lc *loginConfig) askWarehouse(ctx context.Context, w *databricks.Workspace
if !cmdio.IsInteractive(ctx) {
return ErrNotInTTY
}
lc.WarehouseID, err = warehouses.AskForCompatibleWarehouses(ctx, w, lc.Installer.WarehouseTypes)
lc.WarehouseID, err = cfgpickers.AskForWarehouse(ctx, w,
cfgpickers.WithWarehouseTypes(lc.Installer.WarehouseTypes...))
return
}

Expand Down
147 changes: 0 additions & 147 deletions cmd/workspace/clusters/uc.go

This file was deleted.

31 changes: 0 additions & 31 deletions cmd/workspace/clusters/uc_test.go

This file was deleted.

51 changes: 0 additions & 51 deletions cmd/workspace/warehouses/ask.go

This file was deleted.

0 comments on commit 5819644

Please sign in to comment.