Fix HostType() misclassifying account hosts without scheme#1510
Merged
renaudhartert-db merged 4 commits intomainfrom Mar 2, 2026
Merged
Fix HostType() misclassifying account hosts without scheme#1510renaudhartert-db merged 4 commits intomainfrom
renaudhartert-db merged 4 commits intomainfrom
Conversation
When a profile in .databrickscfg contains a host without the https:// scheme (e.g. "accounts.cloud.databricks.com"), HostType() failed to match the "https://accounts." prefix and returned WorkspaceHost instead of AccountHost. This caused NewAccountClient to reject valid account configurations with "invalid Databricks Account configuration". The fix normalizes the host by prepending "https://" when no scheme is present before checking prefixes. The normalization is local to the check and does not mutate c.Host. Signed-off-by: simon <[email protected]>
Signed-off-by: simon <[email protected]>
Avoids per-call slice allocation while keeping the same behavior. Signed-off-by: simon <[email protected]>
The slice groups the prefixes as data, making it easy to add new ones. The allocation cost of a 2-element slice is negligible. Signed-off-by: simon <[email protected]>
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
renaudhartert-db
approved these changes
Mar 2, 2026
3 tasks
renaudhartert-db
added a commit
that referenced
this pull request
Mar 6, 2026
The merge from main dropped the "AWS account without scheme" and "AWS DoD account without scheme" test cases from the TestConfig_HostType table. These were originally added in #1510 and cover schemeless host values in .databrickscfg profiles. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Ubuntu <[email protected]>
github-merge-queue bot
pushed a commit
to databricks/cli
that referenced
this pull request
Mar 9, 2026
## Changes - Bump `github.com/databricks/databricks-sdk-go` from v0.112.0 to v0.117.0 - Update OpenAPI SHA - Regenerate CLI code via `make generate` <details><summary>SDK v0.112 -> v0.117.0 changelog</summary> <p> ## Release v0.117.0 (2026-03-04) ### Internal Changes * Move cloud-based credential filtering from individual strategies into `DefaultCredentials`. Azure strategies are skipped on GCP/AWS hosts in auto-detect mode; GCP strategies are skipped on Azure/AWS hosts. When `auth_type` is explicitly set (e.g. `azure-cli`), cloud filtering is bypassed so the named strategy is always attempted regardless of host cloud. ## Release v0.116.0 (2026-03-03) ### Bug Fixes * Fix `HostType()` misclassifying account hosts when the scheme is missing ([#1510](databricks/databricks-sdk-go#1510)). ## Release v0.115.0 (2026-03-02) ### Internal Changes * Implement dynamic auth token stale period based on initial token lifetime. Increased up to 20 mins for standard OAuth with proportionally shorter periods for short-lived tokens. ### API Changes * Add `CreateDatabase`, `DeleteDatabase`, `GetDatabase`, `ListDatabases` and `UpdateDatabase` methods for [w.Postgres](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#PostgresAPI) workspace-level service. * Add `Postgres` field for [apps.AppResource](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppResource). * Add `DataframeSchema`, `FilterCondition` and `TransformationSql` fields for [ml.DeltaTableSource](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#DeltaTableSource). * Add `EnvironmentVersion` field for [pipelines.PipelinesEnvironment](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#PipelinesEnvironment). * Add `ResetCheckpointSelection` field for [pipelines.StartUpdate](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#StartUpdate). * [Breaking] Remove `Oauth2AppClientId` and `Oauth2AppIntegrationId` fields for [apps.Space](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#Space). * Add `EnablePgNativeLogin` field for [postgres.ProjectSpec](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#ProjectSpec). * Add `EnablePgNativeLogin` field for [postgres.ProjectStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#ProjectStatus). * [Breaking] Remove `NodeTypeFlexibility` field for [compute.EditInstancePool](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#EditInstancePool). ## Release v0.114.0 (2026-02-26) ### API Changes * Add `EffectivePublishingMode` field for [pipelines.GetPipelineResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/pipelines#GetPipelineResponse). * Add `DbrAutoscale` enum value for [compute.EventDetailsCause](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/compute#EventDetailsCause). * Change `OutputCatalog` field for [cleanrooms.CreateCleanRoomOutputCatalogResponse](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/cleanrooms#CreateCleanRoomOutputCatalogResponse) to be required. * [Breaking] Remove `InternalAttributes` field for [sharing.Table](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Table). * [Breaking] Remove `InternalAttributes` field for [sharing.Volume](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/sharing#Volume). ## Release v0.113.0 (2026-02-25) ### New Features and Improvements * Add `DisableAsyncTokenRefresh` field to `Config` to allow disabling asynchronous token refresh for short-lived processes like the Databricks CLI. </p> </details> ## Tests - [x] `make lintfull` - [x] `make test` - [x] `make checks` --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
When a
.databrickscfgprofile contains a host without thehttps://scheme (e.g.host = accounts.cloud.databricks.com),HostType()failed to match thehttps://accounts.prefix and returnedWorkspaceHostinstead ofAccountHost. This causedNewAccountClientto reject valid account configurations with "invalid Databricks Account configuration - host incorrect or account_id missing".This can happen when
auth loginsaves the host from user input that omits the scheme, or when users manually edit their config file.The fix normalizes the host by prepending
https://when no scheme is present before checking prefixes. The normalization is local to the check and does not mutatec.Host.Tests
Added
TestHostType_AwsAccountWithoutSchemeandTestHostType_AwsDodAccountWithoutSchemecovering the schemeless case.