databricks-cli/cmd/root
Miles Yucht 5b819cd982
Always resolve .databrickscfg file (#659)
## Changes
#629 introduced a change to autopopulate the host from .databrickscfg if
the user is logging back into a host they were previously using. This
did not respect the DATABRICKS_CONFIG_FILE env variable, causing the
flow to stop working for users with no .databrickscfg file in their home
directory.

This PR refactors all config file loading to go through one interface,
`databrickscfg.GetDatabricksCfg()`, and an auxiliary
`databrickscfg.GetDatabricksCfgPath()` to get the configured file path.

Closes #655.

## Tests
```
$ databricks auth login --profile abc
Error: open /Users/miles/.databrickscfg: no such file or directory

$ ./cli auth login --profile abc
Error: cannot load Databricks config file: open /Users/miles/.databrickscfg: no such file or directory


$ DATABRICKS_CONFIG_FILE=~/.databrickscfg.bak ./cli auth login --profile abc
Databricks Host: https://asdf
```
2023-08-14 12:45:08 +00:00
..
auth.go Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00
bundle.go Log the bundle root configuration file if applicable (#657) 2023-08-11 12:28:05 +00:00
bundle_test.go Log the bundle root configuration file if applicable (#657) 2023-08-11 12:28:05 +00:00
io.go Remove dependency on global state for the root command (#606) 2023-07-26 11:17:09 +00:00
logger.go Remove dependency on global state for the root command (#606) 2023-07-26 11:17:09 +00:00
progress_logger.go Remove dependency on global state for the root command (#606) 2023-07-26 11:17:09 +00:00
progress_logger_test.go Remove dependency on global state for the root command (#606) 2023-07-26 11:17:09 +00:00
root.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
user_agent.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
user_agent_command.go Move code for including command name in user agent (#203) 2023-02-15 10:33:35 +01:00
user_agent_command_test.go Move code for including command name in user agent (#203) 2023-02-15 10:33:35 +01:00
user_agent_upstream.go Rename: bricks -> databricks (#393) 2023-05-22 16:40:50 +02:00
user_agent_upstream_test.go Let caller set BRICKS_UPSTREAM for user agent (#196) 2023-02-03 17:05:58 +01:00