-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
helpful: fix handling of abbreviated ConfigArgparse arguments #9796
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.
I'm impressed! I personally expect anything related to any of our argument parsing to be a bit of a can of worms but you figured it out with a patch that makes sense to me very quickly. Nice work.
Two questions:
- Is just logging when we can't find the corresponding action what we want to do? Are there any alternative approaches you considered? I don't think I fully grok the implications of this.
- Do you think we should mention this in the changelog? I'm not sure if that was a purposeful omission or just something that wasn't thought about yet.
|
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.
- Ah I see. I'm honestly on the fence. Normally I personally like the idea of failing fast, but it sounds like it's unlikely to matter much and it also looks like continuing without modifying
result
was our previous behavior for arguments set on the command line too. - Haha no worries. I personally think in cases like this it is borderline anyway. My thinking basically is will someone in the future be trying to figure out in what release this was fixed? At this point, it seems unlikely.
If you want to change anything in response to (1) or (2) feel free and I'll prioritize giving it it another review but also feel free to merge as is.
Maybe a compromise for 1 could be upgrading the log statement to |
Yeah. I think you're right both that it's kind of a compromise and that it's hard to communicate. Mainly for the latter reason, I think I personally prefer our two original options:
Both seem unlikely though so I'm personally not too worried about it anymore. |
Sounds good, I think I'll opt for 1 since some of the false-positives from |
Ooo it looks like the tests are triggering the case we (or at least I) thought shouldn't happen. Maybe annoying, but also maybe for the best in helping us understand all this and to do The Right Thing™ here. One minor structural suggestion that you should feel free to push back on though: If we're going to error, maybe we should error inside |
blowing things up always pays off! and sounds good re: moving the exception, i had two separate cases of it to make the error message slightly more descriptive, but it's probably not necessary |
722305d
to
5d6c827
Compare
sorry for the mad commit churn on this, but i think it's in a good spot now for re-review. the CI caught some important edge cases which are now addressed! |
No problem at all on the commit churn. I was going to wait for you to ping me or ask you before rereviewing. PR LGTM except I think the changelog entry will get added to the 2.7.1 release when this is merged. Sorry for the inconvenience. You can fix this by merging in We/I should maybe tackle #8272, especially since I learned about towncrier. |
ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix of an argument, but it doesn't set the argument sources in these cases. This commit checks for those cases and sets the sources appropriately.
These were silently being dropped before, possibly leading to instances of `NamespaceConfig.set_by_user()` returning false negatives.
changelog fixed! also towncrier looks great, i'll take a look at getting something going w/ it |
There's certainly no pressure from my end for you to do so, but #8272 was a newer version of #6462 so this issue has been an annoyance for Certbot devs for a long time that we've never prioritized fixing for whatever reason and it'd be awesome to see some progress on it. |
* helpful: fix handling of abbreviated ConfigArgparse arguments ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix of an argument, but it doesn't set the argument sources in these cases. This commit checks for those cases and sets the sources appropriately. * failing to find an action raises an error instead of logging * Update changelog * Add handling for short arguments, fix equals sign handling These were silently being dropped before, possibly leading to instances of `NamespaceConfig.set_by_user()` returning false negatives. (cherry picked from commit 11e17ef)
* helpful: fix handling of abbreviated ConfigArgparse arguments (#9796) * helpful: fix handling of abbreviated ConfigArgparse arguments ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix of an argument, but it doesn't set the argument sources in these cases. This commit checks for those cases and sets the sources appropriately. * failing to find an action raises an error instead of logging * Update changelog * Add handling for short arguments, fix equals sign handling These were silently being dropped before, possibly leading to instances of `NamespaceConfig.set_by_user()` returning false negatives. (cherry picked from commit 11e17ef) * Fix finish_release.py (#9800) * response is value * rename vars (cherry picked from commit a96fb4b) * Merge pull request #9762 from certbot/docs/yaml-config Add YAML files for Readthedocs requirements (cherry picked from commit 44046c7) * Update Lexicon requirements to stabilize certbot-dns-ovh behavior (#9802) * Update minimum Lexicon version required for certbot-dns-ovh * Add types * FIx mypy * Fix lint * Fix BOTH lint and mypy (cherry picked from commit 5cf5f36) * simplify code (#9807) (cherry picked from commit 6f7b5ab) * Include linting fixes from 8a95c03 --------- Co-authored-by: Will Greenberg <willg@eff.org> Co-authored-by: Alexis <alexis@eff.org> Co-authored-by: Adrien Ferrand <adferrand@users.noreply.github.com>
ConfigArgparse allows for "abbreviated" arguments, i.e. just the prefix of an argument, but it doesn't set the argument sources in these cases. This commit checks for those cases and sets the sources appropriately.
Fixes #9793