-
Notifications
You must be signed in to change notification settings - Fork 375
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
Creating bool debug #1469
Merged
Merged
Creating bool debug #1469
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2ef9ee6
Fix acronyms in struct field names in kubeConfig.go and provider.go
JaylonmcShan03 2e92927
Fixed acronym in kubeConfig that wasnt pushed in previous pr
JaylonmcShan03 c98e6f9
Merge branch 'helm-framework' of https://github.com/hashicorp/terrafo…
JaylonmcShan03 4d30008
Refactored debug handling to use a boolean variable
JaylonmcShan03 393479e
removing unnessary comment
JaylonmcShan03 bc9346b
Updating the debug two conditionals into one
JaylonmcShan03 b440ce0
Fixing edge case logic
JaylonmcShan03 2eb62ef
Simpliyfing if statements
JaylonmcShan03 28a4c3a
Fixing location of debug variable
JaylonmcShan03 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
Oops, something went wrong.
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.
I'm curious how the config overrides the environment variables if both cases set the variable to true.
HELM_DEBUG
where it's "true" will mark `debug = truedebug = true
Yet i don't see how we apply the override of config values instead of env variables if:
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.
the logic sets debug to true if either the environment variable HELM_DEBUG is "true" or if the configuration explicitly sets debug to true.
with my understanding this ensures that debugging is enabled if either source requests it.
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.
In that case we should consider treating the two conditionals as one:
terraform-provider-helm/helm-framework/helm/provider.go
Lines 342 to 348 in 393479e
can be switched to:
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.
Gotcha! Due to the previous confusion where I treated two conditions as one, it wasn't very clear what was going on. But these checks are self explanatory so I will update it!
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.
At a second glance I'm wondering if it's right to use
!config.Debug.IsNull()
Since from my understanding if a user sets
debug = false
it is technically not null anymore and would return true and markdebug = true
despite debug being set to false in the config. Thoughts?Edit: This might be better suited: https://pkg.go.dev/github.com/hashicorp/[email protected]/types/basetypes#BoolValue.ValueBool
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.
Good catch, you are right if the user sets debug. = false, due to it check if its not null it was simply just override it to true. I believe in order to properly handle this scenario > we should check both the null state and the actual boolean value of the Debug field.
I believe it should look something like this >
`debug := false
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.
i believe we can still keep them as one condition since from the docs it says:
So in other words it would return the "known bool value" so it would return
true
ifdebug = true
andfalse
ifdebug = false
in config.if the value is
unknown
orNull
would just returnfalse
.