databricks-cli/libs/databrickscfg
Pieter Noordhuis d4be40520c
Resolve configuration before performing verification (#890)
## Changes

If a bundle configuration specifies a workspace host, and the user
specifies a profile to use, we perform a check to confirm that the
workspace host in the bundle configuration and the workspace host from
the profile are identical. If they are not, we return an error. The
check was introduced in #571.

Previously, the code included an assumption that the client
configuration was already loaded from the environment prior to
performing the check. This was not the case, and as such if the user
intended to use a non-default path to `.databrickscfg`, this path was
not used when performing the check.

The fix does the following:
* Resolve the configuration prior to performing the check.
* Don't treat the configuration file not existing as an error.
* Add unit tests.

Fixes #884.

## Tests

Unit tests and manual confirmation.
2023-10-20 13:10:31 +00:00
..
testdata Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00
host.go Try to resolve a profile if only the host is specified (#287) 2023-03-29 20:44:19 +02:00
host_test.go Try to resolve a profile if only the host is specified (#287) 2023-03-29 20:44:19 +02:00
loader.go Resolve configuration before performing verification (#890) 2023-10-20 13:10:31 +00:00
loader_test.go Resolve configuration before performing verification (#890) 2023-10-20 13:10:31 +00:00
ops.go Resolve configuration before performing verification (#890) 2023-10-20 13:10:31 +00:00
ops_test.go Include [DEFAULT] section header when writing ~/.databrickscfg (#464) 2023-06-13 16:41:56 +00:00
profiles.go Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00
profiles_test.go Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00