Merge "Fix undercloud validate password file" into stable/wallaby

This commit is contained in:
Zuul 2021-06-08 21:52:39 +00:00 committed by Gerrit Code Review
commit 2e1bfc2176
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 # We need 8 GB, leave a little room for variation in what 8 GB means on
# different platforms. # different platforms.
REQUIRED_MB = 7680 REQUIRED_MB = 7680
PASSWORD_PATH = os.path.join(
constants.UNDERCLOUD_OUTPUT_DIR,
'undercloud-passwords.conf'
)
LOG = logging.getLogger(__name__ + ".UndercloudSetup") 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 is missing it will break the undercloud, so we should fail-fast and let
the user know about the problem. 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 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 ' message = (_('The %s file is missing. This will cause all service '
'passwords to change and break the existing ' 'passwords to change and break the existing '
'undercloud. ') % PASSWORD_PATH) 'undercloud. ') % passwd_path)
LOG.error(message) LOG.error(message)
raise FailedValidation(message) raise FailedValidation(message)