Skip to content

Commit

Permalink
Merge pull request #19 from synkd/fail_over_to_latest_sat_version
Browse files Browse the repository at this point in the history
Fail over to the latest valid sat_version
  • Loading branch information
synkd authored Feb 22, 2023
2 parents 0eb009a + 07bb3de commit c3323a4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions manifester/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ def process_sat_version(sat_version, valid_sat_versions):
sat_version = sat_version.split('.')
sat_version = sat_version[0:2]
sat_version = ".".join(sat_version)
# The conditional below assumes that an invalid sat_version with the Z-stream version removed
# is a Y-stream version in development. New Y-stream versions are not available as valid
# sat_version values for the 'POST allocations' endpoint until the corresponding Satellite
# versions are generally available. As of Satellite 6.12, decrementing the Y-stream version
# by 1 works around this constraint, but the conditional below may need to be modified to
# accommodate versioning scheme changes or additional use cases.
# If sat_version is still not valid, default to the latest valid version.
if sat_version not in valid_sat_versions:
sat_version = sat_version.split('.')
sat_version[1] = str(int(sat_version[1]) - 1)
sat_version = ".".join(sat_version)
assert sat_version in valid_sat_versions
return sat_version
valid_sat_versions.sort(key = lambda i: int(i.split('-')[-1].split('.')[-1]), reverse = True)
return valid_sat_versions[0]

0 comments on commit c3323a4

Please sign in to comment.