Skip to content

Commit 5819644

Browse files
committed
cfgpickers
1 parent 321f908 commit 5819644

File tree

5 files changed

+7
-235
lines changed

5 files changed

+7
-235
lines changed

cmd/labs/project/installer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010

1111
"github.com/databricks/cli/cmd/labs/github"
1212
"github.com/databricks/cli/cmd/labs/unpack"
13-
"github.com/databricks/cli/cmd/workspace/clusters"
1413
"github.com/databricks/cli/libs/cmdio"
1514
"github.com/databricks/cli/libs/databrickscfg"
15+
"github.com/databricks/cli/libs/databrickscfg/cfgpickers"
1616
"github.com/databricks/cli/libs/log"
1717
"github.com/databricks/cli/libs/process"
1818
"github.com/databricks/cli/libs/python"
@@ -238,7 +238,7 @@ func (i *installer) setupPythonVirtualEnvironment(ctx context.Context, w *databr
238238
if err != nil {
239239
return fmt.Errorf("cluster: %w", err)
240240
}
241-
runtimeVersion, ok := clusters.GetRuntimeVersion(cluster)
241+
runtimeVersion, ok := cfgpickers.GetRuntimeVersion(*cluster)
242242
if !ok {
243243
return fmt.Errorf("unsupported runtime: %s", cluster.SparkVersion)
244244
}

cmd/labs/project/login.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import (
77
"os"
88

99
"github.com/databricks/cli/cmd/root"
10-
"github.com/databricks/cli/cmd/workspace/clusters"
11-
"github.com/databricks/cli/cmd/workspace/warehouses"
1210
"github.com/databricks/cli/libs/cmdio"
11+
"github.com/databricks/cli/libs/databrickscfg/cfgpickers"
1312
"github.com/databricks/cli/libs/log"
1413
"github.com/databricks/databricks-sdk-go"
1514
"github.com/databricks/databricks-sdk-go/config"
@@ -70,7 +69,8 @@ func (lc *loginConfig) askCluster(ctx context.Context, w *databricks.WorkspaceCl
7069
if !cmdio.IsInteractive(ctx) {
7170
return ErrNotInTTY
7271
}
73-
clusterID, err := clusters.AskForCompatibleCluster(ctx, w, lc.Installer.MinRuntimeVersion)
72+
clusterID, err := cfgpickers.AskForCluster(ctx, w,
73+
cfgpickers.WithDatabricksConnect(lc.Installer.MinRuntimeVersion))
7474
if err != nil {
7575
return fmt.Errorf("select: %w", err)
7676
}
@@ -90,7 +90,8 @@ func (lc *loginConfig) askWarehouse(ctx context.Context, w *databricks.Workspace
9090
if !cmdio.IsInteractive(ctx) {
9191
return ErrNotInTTY
9292
}
93-
lc.WarehouseID, err = warehouses.AskForCompatibleWarehouses(ctx, w, lc.Installer.WarehouseTypes)
93+
lc.WarehouseID, err = cfgpickers.AskForWarehouse(ctx, w,
94+
cfgpickers.WithWarehouseTypes(lc.Installer.WarehouseTypes...))
9495
return
9596
}
9697

cmd/workspace/clusters/uc.go

Lines changed: 0 additions & 147 deletions
This file was deleted.

cmd/workspace/clusters/uc_test.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

cmd/workspace/warehouses/ask.go

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)