From 5589eabcd776eeafd080e819b10508fa12b022c4 Mon Sep 17 00:00:00 2001 From: matbu Date: Thu, 3 Nov 2022 17:36:16 +0100 Subject: [PATCH] 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 --- tripleoclient/v1/undercloud_preflight.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index 69626bd64..cdf05984e 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -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)