Pass undercloud inventory for running preflight validations

The undercloud name is hardcoded in the preflight validations.
This patch generate an undercloud inventory in order to run
preflight validations as prep step of the undercloud install.

Closes-bug: #1994032

Change-Id: I66d6435e41a42a9db1772eea36e41c7a5cf87d23
This commit is contained in:
matbu 2022-11-03 17:36:16 +01:00
parent 0cba88a0c1
commit 5589eabcd7

View File

@ -29,6 +29,7 @@ from oslo_config import cfg
from tripleoclient import constants from tripleoclient import constants
from tripleoclient import utils from tripleoclient import utils
from tripleo_common.inventory import TripleoInventory
class FailedValidation(Exception): class FailedValidation(Exception):
@ -89,7 +90,12 @@ def _run_validations(upgrade=False):
else: else:
playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy'] playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy']
args = ['validation', 'run', '-i', 'undercloud', '--validation', undercloud_hosts_file = os.path.join(constants.CLOUD_HOME_DIR,
'undercloud_ansible_hosts.yaml')
undercloud_inventory = TripleoInventory()
undercloud_inventory.write_static_inventory(undercloud_hosts_file)
args = ['validation', 'run', '-i', undercloud_hosts_file, '--validation',
','.join(playbook_args['playbooks'])] ','.join(playbook_args['playbooks'])]
_run_live_command(args) _run_live_command(args)