Fix undercloud password idempotency

The libvirt tls, rabbit and haproxy stats passwords were getting
duplicated or changed on subsequent runs. This change fixes the way we
were handling the variables for these so they won't be overwritten.

Change-Id: Iecc5e0638f9f43056e6474f8b2556009e8153d30
Closes-Bug: #1777941
This commit is contained in:
Alex Schultz
2018-06-20 15:27:42 -06:00
parent 3726c7750f
commit b5e5dd2c5f

View File

@@ -237,11 +237,25 @@ class Deploy(command.Command):
elif k == 'undercloud_rabbit_username':
k = 'RpcUserName'
elif k == 'undercloud_rabbit_password':
k = 'RpcPassword'
try:
# NOTE(aschultz): Only save rabbit password to rpc
# if it's not already defined for the upgrade case.
# The passwords are usually different so we don't
# want to overwrite it if it already exists because
# we'll end up rewriting the passwords later and
# causing problems.
config.get('auth', 'undercloud_rpc_password')
except Exception:
legacy_env['RpcPassword'] = v
k = 'RabbitPassword'
elif k == 'undercloud_rabbit_cookie':
k = 'RabbitCookie'
elif k == 'undercloud_heat_encryption_key':
k = 'HeatAuthEncryptionKey'
elif k == 'undercloud_libvirt_tls_password':
k = 'LibvirtTLSPassword'
elif k == 'undercloud_ha_proxy_stats_password':
k = 'HAProxyStatsPassword'
else:
k = ''.join(i.capitalize() for i in k.split('_')[1:])
legacy_env[k] = v