From 429169bde6975afd9606b2d410d81e6f32ba2a31 Mon Sep 17 00:00:00 2001 From: Mathieu Bultel Date: Wed, 23 Sep 2020 16:33:06 +0200 Subject: [PATCH] Use validation framework for running undercloud checkdisk The validations playbook is own and moved under the VF ansible dir. The undercloud preflight check should use VF for running it. Change-Id: Id853b1e80d690734ac9c32a1b914e49608f6cc43 (cherry picked from commit 3dd2c83883960bd279e82b9fb0d4a3cb16c5e2cb) (cherry picked from commit 8c7942ed2555dad8c34a7dada88fff5854db1151) --- tripleoclient/v1/undercloud_preflight.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index 460f0100f..50f010635 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -30,6 +30,9 @@ 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 + class FailedValidation(Exception): pass @@ -90,15 +93,16 @@ def _check_diskspace(upgrade=False): else: playbook = 'undercloud-disk-space.yaml' - python_interpreter = "/usr/bin/python{}".format(sys.version_info[0]) - utils.run_ansible_playbook(logger=LOG, - workdir=constants.ANSIBLE_VALIDATION_DIR, - playbook=playbook, - inventory='undercloud,', - retries=False, - connection='local', - output_callback='validation_output', - python_interpreter=python_interpreter) + 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', + log_path=tmp, + validations_dir=constants.ANSIBLE_VALIDATION_DIR, + validation_name=playbook) def _check_memory():