-
Notifications
You must be signed in to change notification settings - Fork 271
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
Version Management #854
Merged
lukpueh
merged 10 commits into
theupdateframework:develop
from
mnm678:version_management
Jun 19, 2019
Merged
Version Management #854
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5ec39d4
added minor version check
mnm678 1326a01
support shorter spec_version
mnm678 9d05dde
bug fix
mnm678 812170c
use distutils.version
mnm678 9e2b5c7
use parse_version
mnm678 45aa0b5
Updated the spec-version check to only parse the version once
mnm678 819a5dd
removed unused import
mnm678 9d5eef1
removed trailing whitespace
mnm678 e7a49a8
minor spec-version comparison now checks for any difference in minor …
mnm678 149d5bd
removed trailing whitespace
mnm678 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1493,8 +1493,13 @@ def _get_metadata_file(self, metadata_role, remote_filename, | |
# number, the new metadata is safe to parse. | ||
try: | ||
metadata_spec_version = metadata_signable['signed']['spec_version'] | ||
metadata_spec_major_version = int(metadata_spec_version.split('.')[0]) | ||
code_spec_major_version = int(tuf.SPECIFICATION_VERSION.split('.')[0]) | ||
metadata_spec_version_split = metadata_spec_version.split('.') | ||
metadata_spec_major_version = int(metadata_spec_version_split[0]) | ||
metadata_spec_minor_version = int(metadata_spec_version_split[1]) | ||
|
||
code_spec_version_split = tuf.SPECIFICATION_VERSION.split('.') | ||
code_spec_major_version = int(code_spec_version_split[0]) | ||
code_spec_minor_version = int(code_spec_version_split[1]) | ||
|
||
if metadata_spec_major_version != code_spec_major_version: | ||
raise tuf.exceptions.UnsupportedSpecificationError( | ||
|
@@ -1503,6 +1508,15 @@ def _get_metadata_file(self, metadata_role, remote_filename, | |
repr(code_spec_major_version) + '; however, the obtained ' | ||
'metadata lists version number: ' + str(metadata_spec_version)) | ||
|
||
#report to user if minor versions do not match, continue with update | ||
if metadata_spec_minor_version != code_spec_minor_version: | ||
logger.info("Downloaded metadata that specifies a different minor " + | ||
"spec_version. This code has version " + | ||
str(tuf.SPECIFICATION_VERSION) + | ||
" and the metadata lists version number " + | ||
str(metadata_spec_version) + | ||
". The update will continue as the major versions match.") | ||
|
||
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. Please try to wrap lines at character 79. 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. OT: This is actually something we should have the linter check as well. |
||
except (ValueError, TypeError): | ||
raise securesystemslib.exceptions.FormatError('Improperly' | ||
' formatted spec_version, which must be in major.minor.fix format') | ||
|
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.
The comment suggests
!=
but the code and the log message>
. Which one is 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.
I updated the operator and message to report any mismatch in the minor version.