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

Closes-Bug: #1995641

Change-Id: I149932625fe474175e3842fa52adfea30021ab5c
(cherry picked from commit 66156f7395)
This commit is contained in:
Douglas Viroel 2022-11-03 17:59:05 -03:00
parent f9ab99cf04
commit 3e496feb67

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,13 +89,9 @@ def _run_validations(upgrade=False):
else:
playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy']
with utils.TempDirs() as tmp:
actions = ValidationActions()
actions.run_validations(
inventory='undercloud',
log_path=tmp,
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():