config: extract ?o=/?a= from Host URL#1699
Open
simonfaltum wants to merge 2 commits into
Open
Conversation
Pasting a SPOG URL from the Databricks UI (e.g. https://acme.databricks.net/?o=12345) into Config.Host previously dropped the workspace identifier on the way through fixHostIfNeeded: the function stripped path and query without promoting them to dedicated fields. The request then went out without an X-Databricks-Org-Id header, the server couldn't route it, and the response came back as the login HTML page, surfacing as ErrHTMLContent ("received HTML response instead of JSON"). Recognize ?o=/?workspace_id= and ?a=/?account_id= as part of host sanitization and promote them into Config.WorkspaceID/Config.AccountID when those fields are empty. Existing values are never overwritten. Co-authored-by: Isaac Signed-off-by: simon <simon.faltum@databricks.com>
Co-authored-by: Isaac Signed-off-by: simon <simon.faltum@databricks.com>
|
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. |
4 tasks
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
Pasting a SPOG URL from the Databricks UI (e.g.
https://acme.databricks.net/?o=12345) intoConfig.Hostpreviously dropped the workspace identifier on the way throughfixHostIfNeeded: the function stripped path and query without promoting them to dedicated fields. The request then went out without anX-Databricks-Org-Idheader, the server couldn't route it, and the response came back as the login HTML page, surfacing asErrHTMLContent("received HTML response instead of JSON").This change recognizes
?o=/?workspace_id=and?a=/?account_id=as part of host sanitization and promotes them intoConfig.WorkspaceID/Config.AccountIDwhen those fields are empty. Existing values are never overwritten.The same fix is going in at the CLI level in databricks/cli#5337 as a stopgap that pre-processes
DATABRICKS_HOST. Once this SDK fix lands and the CLI bumps the SDK version, the CLI-side workaround can be removed.Tests
TestConfig_fixHostIfNeeded_extractsWorkspaceIDFromQueryinconfig/config_test.gocovers:?o=promotion,?workspace_id=promotion,?a=promotion, both together, existingWorkspaceID/AccountIDpreserved, non-numeric?o=dropped, host without query unchanged.make fmt test lintclean.NO_CHANGELOG=true