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
This commit is contained in:
Harald Jensås 2021-05-14 21:56:05 +02:00
parent 956b5d111c
commit 7058c3ee40
1 changed files with 9 additions and 6 deletions

View File

@ -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)