From af5f53aaf5c0dab3424f5ab16ac8cb7d2569fefd Mon Sep 17 00:00:00 2001 From: Dostoievski Batista Date: Fri, 26 Apr 2024 13:33:13 -0300 Subject: [PATCH] Copy upgrade utilities module with precheck script When we upload the patch we copy the precheck script to a versioned folder, this precheck script requires the upgrade utilities module to run. This change copy the upgrade_utils.py after copying the precheck script. Test plan: PASS: Upload patch with precheck and upgrade utilites. Check if file is in versioned folder. Execute `software deploy precheck` on the patch. PASS: Upload patch without precheck and upgrade utilites. Execute `software deploy precheck` on the patch. Story: 2010676 Task: 49982 Change-Id: Ied05fb52e10943e3717462a68685887da68cd1ec Signed-off-by: Dostoievski Batista --- software/software/constants.py | 1 + software/software/software_functions.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/software/software/constants.py b/software/software/constants.py index d85f6ca8..4e0aee02 100644 --- a/software/software/constants.py +++ b/software/software/constants.py @@ -33,6 +33,7 @@ RC_SUCCESS = 0 RC_UNHEALTHY = 3 DEPLOY_PRECHECK_SCRIPT = "deploy-precheck" +UPGRADE_UTILS_SCRIPT = "upgrade_utils.py" DEPLOY_START_SCRIPT = "software-deploy-start" SEMANTICS_DIR = "%s/semantics" % SOFTWARE_STORAGE_DIR diff --git a/software/software/software_functions.py b/software/software/software_functions.py index b3629496..956a251d 100644 --- a/software/software/software_functions.py +++ b/software/software/software_functions.py @@ -993,6 +993,10 @@ class PatchFile(object): tar.extract(constants.DEPLOY_PRECHECK_SCRIPT, path=versioned_dir) os.chmod(versioned_script, mode=0o755) LOG.info("Versioned precheck script copied to %s." % versioned_script) + # precheck script requires upgrade utils module to work and it should + # be included together with precheck script + tar.extract(constants.UPGRADE_UTILS_SCRIPT, path=versioned_dir) + LOG.info("Versioned upgrade_utils module copied to %s." % versioned_script) # in case patch does not contain a precheck script # then symlink to required patch versioned directory else: