-
Notifications
You must be signed in to change notification settings - Fork 883
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
deprecation version boundary #5411
Merged
holmanb
merged 3 commits into
canonical:main
from
holmanb:holmanb/deprecation-version-boundary
Jun 27, 2024
Merged
Changes from all commits
Commits
Show all changes
3 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -87,6 +87,35 @@ | |||||
to write /etc/apt/sources.list directly. | ||||||
""" | ||||||
|
||||||
DEPRECATION_INFO_BOUNDARY = "devel" | ||||||
""" | ||||||
DEPRECATION_INFO_BOUNDARY is used by distros to configure at which upstream | ||||||
version to start logging deprecations at a level higher than INFO. | ||||||
|
||||||
The default value "devel" tells cloud-init to log all deprecations higher | ||||||
than INFO. This value may be overriden by downstreams in order to maintain | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the difference between the suggestion and current values? |
||||||
stable behavior across releases. | ||||||
|
||||||
Jsonschema key deprecations and inline logger deprecations include a | ||||||
deprecated_version key. When the variable below is set to a version, | ||||||
cloud-init will use that version as a demarcation point. Deprecations which | ||||||
are added after this version will be logged as at an INFO level. Deprecations | ||||||
which predate this version will be logged at the higher DEPRECATED level. | ||||||
Downstreams that want stable log behavior may set the variable below to the | ||||||
first version released in their stable distro. By doing this, they can expect | ||||||
that newly added deprecations will be logged at INFO level. The implication of | ||||||
the different log levels is that logs at DEPRECATED level result in a return | ||||||
code of 2 from `cloud-init status`. | ||||||
|
||||||
format: | ||||||
|
||||||
<value> :: = <default> | <version> | ||||||
<default> ::= "devel" | ||||||
<version> ::= <major> "." <minor> ["." <patch>] | ||||||
|
||||||
where <major>, <minor>, and <patch> are positive integers | ||||||
""" | ||||||
|
||||||
|
||||||
def get_features() -> Dict[str, bool]: | ||||||
"""Return a dict of applicable features/overrides and their values.""" | ||||||
|
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.
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.
Just for my info, what's the perspective on dropping the local var declaration 'problem =' which can be used in both info_deprecations and errors append operations? Just to aid readability at the append call site?
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 original code created a tuple with a single element and then appended this single element to a list:
which takes some extra mental gymnastics to realize the end goal is to append to a list
I consider the legibility difference between:
and
to be negligible. The second has less total calls to grok, but the first has an extra variable to track, and since the calls are simple and identical it's quick realize that they do the same thing.
It's really just a style preference. When I find differences like this negligible I typically lean towards the option that involves assigning fewer variables for a few of reasons:
While these reasons reasons seem bit trivial, the impacts add up as code size and complexity grows.
I suppose I could have done this PR without making this change, but the actual reason that this happened due to an earlier iteration subclassing a different type and having to move the assignment within the
if isinstance()
call which necessitated modifying this variable anyways.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 intent/reasoning here thanks.