Add deploy delete check

This commit change is to ensure the from-release deploy data is
not deleted on the running system when upgrade failed.
The deploy delete operation is interrupted if the to-be-deleted
release is the same as running release.

Test Plan:

PASS: build and deploy the iso
PASS: delete the deploy before deploying the to-release on the system
PASS: delete the deploy after deploying the to-release on the system

Task: 52292
Story: 2011357
Change-Id: I6b74e381c8ab34a9b3a2d26f4e5c3529e5a9ce70
Signed-off-by: junfeng-li <junfeng.li@windriver.com>
This commit is contained in:
junfeng-li
2025-06-03 14:20:11 +00:00
parent 1e1d027702
commit 29521b4914

View File

@@ -3566,18 +3566,25 @@ class PatchController(PatchService):
LOG.error(msg_error)
raise SoftwareServiceError(msg_error)
if os.path.isfile(INSTALL_LOCAL_FLAG):
# Remove install local flag if enabled
if os.path.isfile(INSTALL_LOCAL_FLAG):
try:
os.remove(INSTALL_LOCAL_FLAG)
except Exception:
msg_error = "Failed to clear install-local mode flag"
LOG.error(msg_error)
raise SoftwareServiceError(msg_error)
LOG.info("Software deployment in local installation mode is stopped")
if os.path.isfile(INSTALL_LOCAL_FLAG):
try:
os.remove(INSTALL_LOCAL_FLAG)
except Exception:
msg_error = "Failed to clear install-local mode flag"
LOG.error(msg_error)
raise SoftwareServiceError(msg_error)
LOG.info("Software deployment in local installation mode is stopped")
if is_major_release:
if SW_VERSION == major_release:
msg_error = (
f"Deploy {major_release} can't be deleted as it is still the"
"current running software.An error may have occurred during the deploy.")
LOG.error(msg_error)
raise SoftwareServiceError(msg_error)
clean_up_deployment_data(major_release)
# Send message to agents cleanup their ostree environment