Execute undercloud preflight validations via VF binary

Execute undercloud preflight validations via the Validation Framework
binary instead of via the VF API avoid breakage when an API change is introduce.
Its also fix some issues present in the previous implementation:
- the validations was logged in /tmp instead of the /var/log/validations,
  so the logs wasn't shown in the CLI history command.
- the results of the executed validations was never checked, so when the
  validations was failing, the undercloud install can still continue

Change-Id: I149932625fe474175e3842fa52adfea30021ab5c
This commit is contained in:
matbu 2022-09-28 15:39:17 +02:00 committed by Cedric Jeanneret
parent aa8618da4f
commit 66156f7395
1 changed files with 4 additions and 9 deletions

View File

@ -30,8 +30,6 @@ from oslo_config import cfg
from tripleoclient import constants
from tripleoclient import utils
from validations_libs.validation_actions import ValidationActions
class FailedValidation(Exception):
pass
@ -63,7 +61,7 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
return process
while True:
line = process.stdout.readline().decode('utf-8')
line = process.stdout.readline()
if line:
LOG.info(line.rstrip())
if line == '' and process.poll() is not None:
@ -91,12 +89,9 @@ def _run_validations(upgrade=False):
else:
playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy']
with utils.TempDirs() as tmp:
actions = ValidationActions(log_path=tmp)
actions.run_validations(
inventory='undercloud',
validations_dir=constants.ANSIBLE_VALIDATION_DIR,
validation_name=playbook_args['playbooks'])
args = ['validation', 'run', '-i', 'undercloud', '--validation',
','.join(playbook_args['playbooks'])]
_run_live_command(args)
def _check_memory():