Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

~/.databrickscfg is loaded even when direct config has precedence #304

Closed
nfx opened this issue Feb 16, 2023 · 0 comments · Fixed by #306
Closed

~/.databrickscfg is loaded even when direct config has precedence #304

nfx opened this issue Feb 16, 2023 · 0 comments · Fixed by #306
Assignees
Labels
bug Something isn't working

Comments

@nfx
Copy link
Contributor

nfx commented Feb 16, 2023

steps to reproduce:

  • direct host & az resource ID
  • configuration file with DEFAULT profile with token + host
  • expected: azure CLI working for that host
  • happens: validate: more than one authorization method configured: azure and pat error

this issue blocks databricks/terraform-provider-databricks#1848

func TestConfig_AzureCliHostAndResourceID(t *testing.T) {
	p, _ := filepath.Abs("../common/testdata")
	providerFixture{
		// omit request to management endpoint to get workspace properties
		azureResourceID: azResourceID,
		host:            "x",
		env: map[string]string{
			// these may fail on windows. use docker container for testing.
			"PATH": p,
			"HOME": p,
		},
		assertAzure: true,
		assertHost:  "https://x",
		assertAuth:  "azure-cli",
	}.apply(t)
}
@nfx nfx added the bug Something isn't working label Feb 16, 2023
@nfx nfx self-assigned this Feb 16, 2023
@nfx nfx closed this as completed in #306 Feb 17, 2023
pietern added a commit that referenced this issue Apr 6, 2023
## Changes

If a user specified a host to connect to without authentication details
(either directly or via the `DATABRICKS_HOST` environment variable), the
config file loader would load the profile named `DEFAULT` from 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 as `DEFAULT` profile in the config file).
This PR prevents this behavior.

Also see #304.

## Tests

- Added unit tests.
- Confirmed behavior with manual test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant