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 <dostoievski.albinobatista@windriver.com>
This commit is contained in:
Dostoievski Batista 2024-04-26 13:33:13 -03:00
parent c5a7d1d336
commit af5f53aaf5
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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: