Fix error after creating .dogrc when not answering y or n at the prompt#582
Merged
zippolyte merged 3 commits intoDataDog:masterfrom Jun 30, 2020
Merged
Conversation
zippolyte
requested changes
Jun 29, 2020
Contributor
zippolyte
left a comment
There was a problem hiding this comment.
Thanks for this fix. I added one suggestion, to avoid the same bug when answering yes.
datadog/dogshell/common.py
Outdated
| while response is None or response.strip().lower() not in ['', 'y', 'n']: | ||
| response = get_input('%s does not exist. Would you like to' | ||
| ' create it? [Y/n] ' % config_file) | ||
| if response.strip().lower() in ['', 'y', 'yes']: |
Contributor
There was a problem hiding this comment.
Suggested change
| if response.strip().lower() in ['', 'y', 'yes']: | |
| if response.strip().lower() in ['', 'y']: |
Contributor
Author
There was a problem hiding this comment.
Hi @zippolyte,
Indeed, I didn't see this one ! I applied the additional fix !
Edit : I think both commits can be squashed at the merge.
zippolyte
approved these changes
Jun 30, 2020
Contributor
|
/azp run DataDog.datadogpy.integration |
|
Azure Pipelines successfully started running 1 pipeline(s). |
.dogrc when not answering y or n at the prompt
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requirements for Contributing to this repository
What does this PR do?
This pull request is related to bug presented in the issue #580
Description of the Change
The while loop used to wait the user entry was set to break only if
yornwas found but the empty response permits to create the configuration file (response.strip().lower() not in ['', 'y', 'n'])I set the default response as
Noneand make the while continues if the response is None or different of['', 'y', 'n'].Alternate Designs
I thought about using a non empty string as the default response, for example
'None'instead ofNoneto lighten the while condition but is a bit cheap from my point of view.Verification Process
Additional Notes
It's my first PR on datadog, I followed the CONTRIBUTING.md let me know if I missed a step.
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.