Fix to prevent mishandling of OS_REGION_NAME

With the Subcloud Rename Feature, a mechanism was introduced in
dcmanager, when the deployment file is uploaded, to modify the
OS_REGION_NAME prior to send it to the subcloud, required for
the installation of the Deployment.

Doing this manipulation of the deployment file on the dcmanager
site generates confusion for the handling of the required
OS_REGION_NAME parameter.

This commit revers the change to handle the deployment file from
the dcmanager, passing the responsability to the Deployment.

Closes-Bug: 2036632

Test Plan:

PASS: Add a new subcloud and validate the content of
deployment_config.yaml inside of subcloud. The value of
OS_REGION_NAME parameter should be equal to the same parameter
taken from environment variables.

Change-Id: Ie50459930e968ab5b5c0940e71110b636df297a6
Signed-off-by: Cristian Mondo <cristian.mondo@windriver.com>
This commit is contained in:
Cristian Mondo
2023-09-19 12:03:10 -03:00
parent 3d6ee3c03e
commit 4ed1f39731

View File

@@ -731,18 +731,7 @@ def upload_deploy_config_file(request, payload):
pecan.abort(400, _("No %s file uploaded" % consts.DEPLOY_CONFIG))
file_item.file.seek(0, os.SEEK_SET)
file_lines = file_item.file.readlines()
# Updates the OS_REGION_NAME param which is required for deployment
contents = ""
for line in file_lines:
dec_line = line.decode('utf8')
if consts.OS_REGION_NAME in dec_line:
os_reg_item = dec_line.split(":")
dec_line = os_reg_item[0] + ": " + payload['region_name'] + "\n"
contents = contents + dec_line
contents = contents.encode()
contents = file_item.file.read()
# the deploy config needs to upload to the override location
fn = get_config_file_path(payload['name'], consts.DEPLOY_CONFIG)
upload_config_file(contents, fn, consts.DEPLOY_CONFIG)