Report rehoming playbook failures

This commit extends ansible error catching for rehoming
subcloud operation.

Test plan:
PASS: Intentionally force a failure in the rehoming playbook.
      Verify that the error is displayed correctly

Closes-bug: 2047645

Change-Id: I4571e04247bdcf273f5de860ae5032597b173ed2
Signed-off-by: fperez <fabrizio.perez@windriver.com>
This commit is contained in:
fperez 2023-12-26 20:39:49 -03:00 committed by Fabrizio Perez
parent e0a09c9860
commit 04c8b51b40
1 changed files with 4 additions and 1 deletions

View File

@ -796,9 +796,12 @@ class SubcloudManager(manager.Manager):
f" for subcloud {subcloud.name}, check individual log at " \
f"{log_file} for detailed output."
LOG.error(msg)
msg = utils.find_ansible_error_msg(
subcloud.name, log_file, consts.DEPLOY_STATE_REHOMING)
db_api.subcloud_update(
context, subcloud.id,
deploy_status=consts.DEPLOY_STATE_REHOME_FAILED)
deploy_status=consts.DEPLOY_STATE_REHOME_FAILED,
error_description=msg[0:consts.ERROR_DESCRIPTION_LENGTH])
return
# Update the deploy status to complete and rehomed flag to true only
# after playbook execution succeeded.