From 7058c3ee404c9ebfdd6cd0f9ad1b55d0c7a8a44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 14 May 2021 21:56:05 +0200 Subject: [PATCH] Fix undercloud validate password file In change: Idded7faba1ff6c811b94503c559029aeeaca6a06 the default directory where undercloud generated artifacts are stored was changed. The undercloud pre-flight check for the password file was not updated, cause undercloud install re-run to fail. Change-Id: I3f3865cc0f07b3b32e96a42a27a7b03386a1530b Closes-Bug: #1928501 --- tripleoclient/v1/undercloud_preflight.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index bd664d838..baa3de7f7 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -42,10 +42,6 @@ CONF = cfg.CONF # We need 8 GB, leave a little room for variation in what 8 GB means on # different platforms. REQUIRED_MB = 7680 -PASSWORD_PATH = os.path.join( - constants.UNDERCLOUD_OUTPUT_DIR, - 'undercloud-passwords.conf' -) LOG = logging.getLogger(__name__ + ".UndercloudSetup") @@ -332,11 +328,18 @@ def _validate_passwords_file(): is missing it will break the undercloud, so we should fail-fast and let the user know about the problem. """ + if not CONF.get('output_dir'): + output_dir = os.path.join(constants.UNDERCLOUD_OUTPUT_DIR, + 'tripleo-deploy', 'undercloud') + else: + output_dir = CONF['output_dir'] + + passwd_path = os.path.join(output_dir, 'undercloud-passwords.conf') if (os.path.isfile(os.path.join(constants.CLOUD_HOME_DIR, 'stackrc')) and - not os.path.isfile(PASSWORD_PATH)): + not os.path.isfile(passwd_path)): message = (_('The %s file is missing. This will cause all service ' 'passwords to change and break the existing ' - 'undercloud. ') % PASSWORD_PATH) + 'undercloud. ') % passwd_path) LOG.error(message) raise FailedValidation(message)