Skip to content

Commit

Permalink
Validate target OS update version is not same as current
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
  • Loading branch information
kb2ma committed Feb 8, 2025
1 parent 0c23890 commit 255b288
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions balena/hup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def get_hup_action_type(device_type: str, current_version: Optional[str], target
if Version.parse(target_version).compare(current_version) < 0:
raise exceptions.OsUpdateError("OS downgrades are not allowed")

if Version.parse(target_version).compare(current_version) == 0:
raise exceptions.OsUpdateError("Current OS version matches Target OS version")

# For 1.x -> 2.x or 2.x to 2.x only
if parsed_target_ver.major > 1 and Version.parse(target_version).compare(MIN_TARGET_VERSION) < 0:
raise exceptions.OsUpdateError("Target balenaOS version must be greater than {0}".format(MIN_TARGET_VERSION))
Expand Down

0 comments on commit 255b288

Please sign in to comment.