-
Notifications
You must be signed in to change notification settings - Fork 69
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
Make databricks configure
save only explicit fields
#973
Merged
+78
−3
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
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.
Please also set the
DATABRICKS_TOKEN
env var to some value to make sure it doesn't have precedence over the value that the user provides through stdin.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.
With the current logic it will pick up the token from the env var and won't even try to ask for a new one from a user (or read from sdtin). From git blame I figured it is a feature, as it was added explicitly - the CLI is able to bootstrap the config based on the environment variables, and if there's enough of them, it will pretty much create a config automatically without any additional prompts.
To me it feels a bit counter intuitive, I would expect
databricks configure
to always ask all of its inputs. With the current logic it should be nameddatabrikcs write-to-config
instead, notconfigure
(since in some cases you don't even configure anything).Would it make sense to remove reading from the environment completely?
cli/cmd/configure/configure.go
Line 140 in 3284a8c
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.
And a side note: databricks vscode extension doesn't set the token env variable, only host with metadata
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.
There will be users who set these env vars and expect it to work (predominantly for automation), so let's keep it in tact. I have seen cases where the token is passed through stdin, the rest being set through env vars. Looking at the test context I figured the other env vars would also be masked out, but since it makes sense, disregard my comment.
Do we already have a test confirming that this behavior works? I.e. pass the host and token as env vars and the command silently succeeds and writes out a profile?
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.
Added a test to confirm that
configure
works with both token and host taken from the env vars