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 <victor.gluzromano@windriver.com>
This commit is contained in:
Victor Romano 2024-01-03 11:49:32 -03:00
parent f099e2d1a6
commit c06d637cea
1 changed files with 2 additions and 1 deletions

View File

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