Skip to content

Commit

Permalink
Merge pull request #854 from mnm678/version_management
Browse files Browse the repository at this point in the history
Version Management
  • Loading branch information
lukpueh authored Jun 19, 2019
2 parents 49e75ff + 149d5bd commit 65e5ee1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tuf/client/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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.")

except (ValueError, TypeError):
raise securesystemslib.exceptions.FormatError('Improperly'
' formatted spec_version, which must be in major.minor.fix format')
Expand Down

0 comments on commit 65e5ee1

Please sign in to comment.