diff --git a/Makefile b/Makefile index 1b6f058f262..75e7d0860d8 100644 --- a/Makefile +++ b/Makefile @@ -207,8 +207,16 @@ GENKIT_BINARY := $(UNIVERSE_DIR)/bazel-bin/openapi/genkit/genkit_/genkit .PHONY: generate generate: - @echo "Checking out universe at SHA: $$(cat .codegen/_openapi_sha)" - cd $(UNIVERSE_DIR) && git cat-file -e $$(cat $(PWD)/.codegen/_openapi_sha) 2>/dev/null || git fetch --filter=blob:none origin master && git checkout $$(cat $(PWD)/.codegen/_openapi_sha) + @if [ -z "$$UNIVERSE_SKIP_CHECKOUT" ]; then \ + if ! git -C $(UNIVERSE_DIR) diff --quiet || ! git -C $(UNIVERSE_DIR) diff --cached --quiet; then \ + echo "Error: universe repo at $(UNIVERSE_DIR) has uncommitted changes; commit or stash them, or set UNIVERSE_SKIP_CHECKOUT=1 to skip checkout"; \ + exit 1; \ + fi; \ + echo "Checking out universe at SHA: $$(cat .codegen/_openapi_sha)"; \ + cd $(UNIVERSE_DIR) && (git cat-file -e $$(cat $(PWD)/.codegen/_openapi_sha) 2>/dev/null || (git fetch --filter=blob:none origin master && git checkout $$(cat $(PWD)/.codegen/_openapi_sha))); \ + else \ + echo "UNIVERSE_SKIP_CHECKOUT set; using current $(UNIVERSE_DIR) HEAD"; \ + fi @echo "Building genkit..." cd $(UNIVERSE_DIR) && bazel build //openapi/genkit @echo "Generating CLI code..." diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 17fc85feeca..1384f2db5e0 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -8,6 +8,7 @@ * Remove the `--experimental-is-unified-host` flag and stop reading `experimental_is_unified_host` from `.databrickscfg` profiles and the `DATABRICKS_EXPERIMENTAL_IS_UNIFIED_HOST` env var. Unified hosts are now detected exclusively from `/.well-known/databricks-config` discovery. The `experimental_is_unified_host` field is retained as a no-op in `databricks.yml` for schema compatibility. * Added interactive pagination for list commands that have a row template (jobs, clusters, apps, pipelines, etc.). When stdin, stdout, and stderr are all TTYs, `databricks list` now streams 50 rows at a time and prompts `[space] more [enter] all [q|esc] quit`. ENTER can be interrupted by `q`/`esc`/`Ctrl+C` between pages. Colors and alignment match the existing non-paged output; column widths stay stable across pages. Piped output and `--output json` are unchanged. * Added experimental OS-native secure token storage opt-in via `DATABRICKS_AUTH_STORAGE=secure`. Legacy file-backed token storage remains the default. +* Fixed a panic in `databricks warehouses update-default-warehouse-override` when invoked without all required positional arguments (e.g. picking a warehouse from the interactive drop-down and then hitting an index-out-of-range crash). The command now validates arguments up front and returns a usage error. Fixes [#5070](https://github.com/databricks/cli/issues/5070) via [#5079](https://github.com/databricks/cli/pull/5079). ### Bundles diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index 7d64d24a542..ff7160ec8c5 100755 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -1388,7 +1388,8 @@ func newUpdateDefaultWarehouseOverride() *cobra.Command { } return nil } - return nil + check := root.ExactArgs(3) + return check(cmd, args) } cmd.PreRunE = root.MustWorkspaceClient @@ -1407,29 +1408,13 @@ func newUpdateDefaultWarehouseOverride() *cobra.Command { return err } } - } else { - if len(args) == 0 { - sp := cmdio.NewSpinner(ctx) - sp.Update("No TYPE argument specified. Loading names for Warehouses drop-down.") - names, err := w.Warehouses.EndpointInfoNameToIdMap(ctx, sql.ListWarehousesRequest{}) - sp.Close() - if err != nil { - return fmt.Errorf("failed to load names for Warehouses drop-down. Please manually specify required arguments. Original error: %w", err) - } - id, err := cmdio.Select(ctx, names, "The type of override behavior") - if err != nil { - return err - } - args = append(args, id) - } - if len(args) != 1 { - return fmt.Errorf("expected to have the type of override behavior") - } - updateDefaultWarehouseOverrideReq.Name = args[0] - if args[1] != "" { - updateMaskArray := strings.Split(args[1], ",") - updateDefaultWarehouseOverrideReq.UpdateMask = *fieldmask.New(updateMaskArray) - } + } + updateDefaultWarehouseOverrideReq.Name = args[0] + if args[1] != "" { + updateMaskArray := strings.Split(args[1], ",") + updateDefaultWarehouseOverrideReq.UpdateMask = *fieldmask.New(updateMaskArray) + } + if !cmd.Flags().Changed("json") { _, err = fmt.Sscan(args[2], &updateDefaultWarehouseOverrideReq.DefaultWarehouseOverride.Type) if err != nil { return fmt.Errorf("invalid TYPE: %s", args[2])