Skip loading default profile if host is already configured#363
Merged
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #363 +/- ##
==========================================
- Coverage 41.89% 41.82% -0.08%
==========================================
Files 50 50
Lines 2788 2788
==========================================
- Hits 1168 1166 -2
- Misses 1517 1518 +1
- Partials 103 104 +1
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
nfx
suggested changes
Apr 6, 2023
alexott
reviewed
Apr 6, 2023
mgyucht
approved these changes
Apr 6, 2023
| // IsAws returns if the client is configured for Databricks on AWS. | ||
| func (c *Config) IsAws() bool { | ||
| return !c.IsAzure() && !c.IsGcp() | ||
| return c.Host != "" && !c.IsAzure() && !c.IsGcp() |
Contributor
There was a problem hiding this comment.
Allow-list version may also be safer:
strings.Contains(c.Host, ".dev.databricks.com") || strings.Contains(c.Host, ".cloud.databricks.com")
Contributor
Author
There was a problem hiding this comment.
True, but we would have this problem: #363 (comment)
alexott
approved these changes
Apr 6, 2023
nfx
approved these changes
Apr 6, 2023
Merged
nfx
added a commit
that referenced
this pull request
Apr 20, 2023
# Version changelog ## 0.8.0 * Added more code generation utilities ([#369](#369)). * Body logger for non-JSON payload as well ([#365](#365)). * Cleanup ephemeral groups in integration tests ([#368](#368)). * Fixed external entity generation ([#372](#372)). * Skip loading default profile if host is already configured ([#363](#363)). * Update debug messages in config loader to display correct path ([#362](#362)). Dependency updates: * Bump golang.org/x/oauth2 from 0.6.0 to 0.7.0 ([#364](#364)). * Bump google.golang.org/api from 0.115.0 to 0.116.0 ([#361](#361)). * Bump google.golang.org/api from 0.116.0 to 0.118.0 ([#367](#367)). API changes: * Moved `clusterpolicies` APIs to `compute` package. * Moved `clusters` APIs to `compute` package. * Moved `commands` APIs to `compute` package. * Moved `globalinitscripts` APIs to `compute` package. * Moved `instancepools` APIs to `compute` package. * Moved `scim` APIs to `iam` package. * Moved `permissions` APIs to `iam` package. * Moved `ipaccesslists` APIs to `settings` package. * Moved `tokenmanagement` APIs to `settings` package. * Moved `tokens` APIs to `settings` package. * Moved `workspaceconf` APIs to `settings` package. * Moved `gitcredentials` APIs to `workspace` package. * Moved `repos` APIs to `workspace` package. * Moved `secrets` APIs to `workspace` package. * Split `unitcatalog` package to `catalog` and `sharing`. * Renamed `mlflow` package to `ml`. * Renamed `dbfs` package to `files`. * Renamed `deployment` package to `provisioning`. * Renamed `endpoints` package to `serving`. * Renamed `clusters.List` type to `compute.ListClustersRequest`. * Renamed `jobs.ListRuns` type to `jobs.ListRunsRequest`. * Renamed `jobs.ExportRun` type to `jobs.ExportRunRequest`. * Renamed `clusterpolicies.List` type to `compute.ListClusterPoliciesRequest`. * Renamed `jobs.List` type to `jobs.ListJobsRequest`. * Renamed `permissions.GetPermissionLevels` type to `iam.GetPermissionLevelsRequest`. * Renamed `pipelines.ListPipelineEvents` type to `pipelines.ListPipelineEventsRequest`. * Renamed `pipelines.ListPipelines` type to `pipelines.ListPipelinesRequest`. * Renamed `workspaceconf.GetStatus` type to `settings.GetStatusRequest`. * Renamed `repos.List` type to `workspace.ListReposRequest`. * Renamed `tokenmanagement.List` type to `settings.ListTokenManagementRequest`. * Renamed `workspace.Export` type to `workspace.ExportRequest`. * Renamed `workspace.List` type to `workspace.ListWorkspaceRequest`.
This was referenced Jun 13, 2023
pietern
added a commit
to databricks/databricks-sdk-py
that referenced
this pull request
Jun 13, 2023
## Changes Incorporate auth permutations tests from databricks/databricks-sdk-go#363 and databricks/databricks-sdk-go#496. ## Tests - [x] `make test` run locally - [x] `make fmt` applied - [ ] relevant integration tests applied
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
If a user specified a host to connect to without authentication details (either directly or via the
DATABRICKS_HOSTenvironment variable), the config file loader would load the profile namedDEFAULTfrom the config file and overwrite whatever was already configured. This means it was possible to configure the host of workspace A and end up connecting to workspace B (if configured asDEFAULTprofile in the config file). This PR prevents this behavior.Also see #304.
Tests