Fix issue on secure_system.yaml not being updated

The password in the hieradata secure_system.yaml file unexpectedly
did not update with the new password after being the command
'openstack user password set'. This issue appears in IPV6 and IPV4
controllers. The fix gets the right field inside the object
address.

Files changed after this change:
  /opt/platform/puppet/<software-version>/hieradata/secure_system.yaml

Test Plan:

PASS: Verify on a controller with IPV6 enabled if the 'openstack
      user password set' changes the password on the keystone
PASS: Verify file hieradata/secure_system.yaml is updated with
      new password after 'openstack user password set' command
PASS: Verify on a controller with IPV4 enabled if the 'openstack
      user password set' changes the password on the keystone

Closes-bug: 1949983
Change-Id: I7f624625ac20ddcdeceee7eed305666fc0643170
Signed-off-by: Alexandre Horst <alexandre.horst@windriver.com>
This commit is contained in:
Alexandre Horst 2021-11-17 16:25:26 -03:00
parent 4ac2c513d6
commit 26ffb94304
1 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,7 @@ class NotificationEndpoint(object):
def get_transport_url():
try:
db_api = dbapi.get_instance()
address = db_api.address_get_by_name(
network_object = db_api.address_get_by_name(
utils.format_address_name(constants.CONTROLLER_HOSTNAME,
constants.NETWORK_TYPE_MGMT)
)
@ -65,10 +65,12 @@ def get_transport_url():
auth_password = keyring.get_password('amqp', 'rabbit')
if utils.is_valid_ipv6(address.address):
address = "[%s]" % address.address
if utils.is_valid_ipv6(network_object.address):
ip_address = "[%s]" % network_object.address
else:
ip_address = "%s" % network_object.address
transport_url = "rabbit://guest:%s@%s:5672" % (auth_password, address)
transport_url = "rabbit://guest:%s@%s:5672" % (auth_password, ip_address)
return transport_url