From 52ee6e15f71998236b860a5053005ab0adccbbd5 Mon Sep 17 00:00:00 2001 From: matbu Date: Thu, 2 Sep 2021 14:04:33 +0200 Subject: [PATCH] [Train-Only] Run Validations outside of mistral for the deployment In Train we still run Validation over Mistral for the Deployment which is broken atm. Some pieces of the code has been dropped which make the option --run-validations broken. This review just call, like the undercloud-preflight Validations, the Validation Framework instead of Mistral. The results and output if some Validations failed will be easier to debug, which is very difficult to do in the Mistral context. Relared BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1974353 Change-Id: I88d7d09c2f3cf1b5bb23bca3e1436ea8e2ca0d07 --- tripleoclient/v1/overcloud_deploy.py | 22 +++++++++++++++++++++- tripleoclient/v1/undercloud_preflight.py | 4 ---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 3a31a103d..7dc1b3b8c 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -45,6 +45,8 @@ from tripleoclient.workflows import deployment from tripleoclient.workflows import parameters as workflow_params from tripleoclient.workflows import plan_management +from validations_libs.validation_actions import ValidationActions + class DeployOvercloud(command.Command): """Deploy Overcloud""" @@ -276,11 +278,29 @@ class DeployOvercloud(command.Command): if not update_plan_only: print("Deploying templates in the directory {0}".format( os.path.abspath(tht_root))) + if run_validations: + actions = ValidationActions() + results = actions.run_validations( + inventory='undercloud', + log_path=constants.VALIDATIONS_LOG_BASEDIR, + validations_dir=constants.ANSIBLE_VALIDATION_DIR, + group='pre-deployment') + failed_list = [r.get('UUID') for r in results + if r.get('Status') == 'FAILED'] + if failed_list: + msg = ("Validations has failed, check log results " + "under {}, for: {}.") + raise exceptions.DeploymentError( + msg.format(constants.VALIDATIONS_LOG_BASEDIR, + ', '.join(failed_list)) + ) + # Force run_validations to False in order to skip the mistral + # Validation run. deployment.deploy_and_wait( self.log, self.clients, stack, stack_name, self.app_args.verbose_level, timeout=timeout, - run_validations=run_validations, + run_validations=False, skip_deploy_identifier=skip_deploy_identifier, deployment_options=deployment_options) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index 50f010635..d9c58d790 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -30,7 +30,6 @@ from oslo_config import cfg from tripleoclient import constants from tripleoclient import utils -from validations_libs import constants as v_consts from validations_libs.validation_actions import ValidationActions @@ -94,9 +93,6 @@ def _check_diskspace(upgrade=False): playbook = 'undercloud-disk-space.yaml' with utils.TempDirs() as tmp: - # @matbu: todo: removed this when [1] will be merged - # [1] https://review.opendev.org/753845 - v_consts.VALIDATION_ANSIBLE_ARTIFACT_PATH = "{}/artifacts".format(tmp) actions = ValidationActions() actions.run_validations( inventory='undercloud',