-
Notifications
You must be signed in to change notification settings - Fork 72
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
Always resolve .databrickscfg file #659
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- this looks good. Comment on function name.
libs/databrickscfg/profiles.go
Outdated
|
||
func LoadProfiles(path string, fn ProfileMatchFunction) (file string, profiles Profiles, err error) { | ||
f, err := config.LoadFile(path) | ||
func GetDatabricksCfg() (*config.File, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be just Get()
-- the rest is implied by the package name.
libs/databrickscfg/profiles.go
Outdated
@@ -64,12 +66,34 @@ func MatchAllProfiles(p Profile) bool { | |||
return true | |||
} | |||
|
|||
const DefaultPath = "~/.databrickscfg" | |||
// Get the path to the .databrickscfg file, falling back to the default in the current user's home directory. | |||
func GetDatabricksCfgPath() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be GetPath()
-- rest implied by the package name.
CLI: * Always resolve .databrickscfg file ([#659](#659)). Bundles: * Add internal tag for bundle fields to be skipped from schema ([#636](#636)). * Log the bundle root configuration file if applicable ([#657](#657)). * Execute paths without the .tmpl extension as templates ([#654](#654)). * Enable environment overrides for job clusters ([#658](#658)). * Merge artifacts and resources block with overrides enabled ([#660](#660)). * Locked terraform binary version to <= 1.5.5 ([#666](#666)). * Return better error messages for invalid JSON schema types in templates ([#661](#661)). * Use custom prompter for bundle template inputs ([#663](#663)). * Add map and pair helper functions for bundle templates ([#665](#665)). * Correct name for force acquire deploy flag ([#656](#656)). * Confirm that override with a zero value doesn't work ([#669](#669)). Internal: * Consolidate functions in libs/git ([#652](#652)). * Upgraded Go version to 1.21 ([#664](#664)).
CLI: * Always resolve .databrickscfg file ([#659](#659)). Bundles: * Add internal tag for bundle fields to be skipped from schema ([#636](#636)). * Log the bundle root configuration file if applicable ([#657](#657)). * Execute paths without the .tmpl extension as templates ([#654](#654)). * Enable environment overrides for job clusters ([#658](#658)). * Merge artifacts and resources block with overrides enabled ([#660](#660)). * Locked terraform binary version to <= 1.5.5 ([#666](#666)). * Return better error messages for invalid JSON schema types in templates ([#661](#661)). * Use custom prompter for bundle template inputs ([#663](#663)). * Add map and pair helper functions for bundle templates ([#665](#665)). * Correct name for force acquire deploy flag ([#656](#656)). * Confirm that override with a zero value doesn't work ([#669](#669)). Internal: * Consolidate functions in libs/git ([#652](#652)). * Upgraded Go version to 1.21 ([#664](#664)).
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 auxiliarydatabrickscfg.GetDatabricksCfgPath()
to get the configured file path.Closes #655.
Tests