From c06d637cea6436f2d993e70b9aff60616865ddaa Mon Sep 17 00:00:00 2001 From: Victor Romano Date: Wed, 3 Jan 2024 11:49:32 -0300 Subject: [PATCH] Fix redeploy not loading config files correctly When redeploying a subcloud installed with current release providing a previous release (and vice-versa), the config files from the currently installed version is loaded, resulting in config failure. This commit fixes this problem, trying to first load using the release from payload, and falling back to the installed release if not available. Test plan: - PASS: Redeploy a subcloud from current version providing a previous release. Verify the config files were loaded correctly and the subcloud was successfully redeployed to completion. - PASS: Redeploy a subcloud providing the same installed release as a parameter. Verify the config files were loaded correctly and the subcloud was successfully redeployed to completion. Story: 2010756 Task: 49362 Change-Id: I7d73a529707d3e22fd9edd1b7d9f95e6c9dca04a Signed-off-by: Victor Romano --- distributedcloud/dcmanager/common/phased_subcloud_deploy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distributedcloud/dcmanager/common/phased_subcloud_deploy.py b/distributedcloud/dcmanager/common/phased_subcloud_deploy.py index 57f9ca2ac..f55675310 100644 --- a/distributedcloud/dcmanager/common/phased_subcloud_deploy.py +++ b/distributedcloud/dcmanager/common/phased_subcloud_deploy.py @@ -946,6 +946,7 @@ def get_subcloud_db_install_values(subcloud): def populate_payload_with_pre_existing_data(payload: dict, subcloud: models.Subcloud, mandatory_values: typing.Sequence): + software_version = payload.get('software_version', subcloud.software_version) for value in mandatory_values: if value == consts.INSTALL_VALUES: if not payload.get(consts.INSTALL_VALUES): @@ -971,7 +972,7 @@ def populate_payload_with_pre_existing_data(payload: dict, "previously available.") % consts.DEPLOY_CONFIG pecan.abort(400, msg) payload.update({value: fn}) - get_common_deploy_files(payload, subcloud.software_version) + get_common_deploy_files(payload, software_version) def pre_deploy_create(payload: dict, context: RequestContext,