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
(cherry picked from commit 5589eabcd7)
This commit is contained in:
matbu 2022-11-03 17:36:16 +01:00 committed by Jiri Podivin
parent 3e496feb67
commit 633ce48624
1 changed files with 7 additions and 1 deletions

View File

@ -29,6 +29,7 @@ from oslo_config import cfg
from tripleoclient import constants
from tripleoclient import utils
from tripleo_common.inventory import TripleoInventory
class FailedValidation(Exception):
@ -89,7 +90,12 @@ def _run_validations(upgrade=False):
else:
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'])]
_run_live_command(args)