From de070dbf3e1e5ab32e1e91493cb5d3eaf103eeda Mon Sep 17 00:00:00 2001 From: Heitor Matsui Date: Mon, 5 Feb 2024 10:14:27 -0300 Subject: [PATCH] Include "deployed" in valid deploy start states This commit creates a list of valid deploy start states and include "deployed" in the valid states to cover the patch removal scenario, that is currently blocked. This issue was introduced by [1]. [1] https://review.opendev.org/c/starlingx/update/+/906381 Test Plan PASS: run deploy precheck/start for available release (patch install) PASS: run deploy precheck/start for deployed release (patch remove) PASS: run deploy precheck/start for release not in a valid state Story: 2010676 Task: 49523 Change-Id: I300517e34aa795615586e51bf71ce7ddb1ca6f1f Signed-off-by: Heitor Matsui --- software/software/constants.py | 4 ++++ software/software/software_controller.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/software/software/constants.py b/software/software/constants.py index 6a95bdc8..39ddcf49 100644 --- a/software/software/constants.py +++ b/software/software/constants.py @@ -62,6 +62,10 @@ REMOVING = 'removing' UNAVAILABLE = 'unavailable' UNKNOWN = 'n/a' +VALID_DEPLOY_START_STATES = [ + AVAILABLE, + DEPLOYED, +] STATUS_DEVELOPEMENT = 'DEV' STATUS_OBSOLETE = 'OBS' diff --git a/software/software/software_controller.py b/software/software/software_controller.py index 7ef9aa6b..580d2351 100644 --- a/software/software/software_controller.py +++ b/software/software/software_controller.py @@ -1883,7 +1883,7 @@ class PatchController(PatchService): success = False # Check if release state is valid - elif release["state"] not in [constants.AVAILABLE]: + elif release["state"] not in constants.VALID_DEPLOY_START_STATES: msg = "Software release state is invalid: %s" % release["state"] LOG.error(msg) msg_error += msg