Use non-bracketed version of addresses for keystone.initialize

os-cloud-config will add brackets around IPv6 addresses [1] as
needed, we can't use bracketed version for the ssh command
so this change restores use of KeystoneAdminVip output,
previously removed by I0cf9ada1110f6b1452480039c136aee1fc3ccc82

1. https://github.com/openstack/os-cloud-config/blob/master/os_cloud_config/keystone.py#L542

Closes-Bug: 1612463

Change-Id: I7d82f93b9d4e38e6a2da5c6b6a6d7b803890b440
(cherry picked from commit 3665888fe4)
This commit is contained in:
Giulio Fidente 2016-08-12 01:30:19 +02:00
parent 9cc645c479
commit 4e67a9b844
2 changed files with 17 additions and 0 deletions

View File

@ -106,6 +106,21 @@ def bracket_ipv6(address):
return address
def unbracket_ipv6(address):
"""Remove a bracket around addresses if it is valid IPv6
Return it unchanged if it is a hostname or IPv4 address.
"""
if '[' and ']' in address:
s = address[address.find("[") + 1:address.find("]")]
try:
socket.inet_pton(socket.AF_INET6, s)
return s
except socket.error:
pass
return address
def create_overcloudrc(stack, no_proxy, config_directory='.'):
"""Given proxy settings and stack, create the overcloudrc

View File

@ -418,7 +418,9 @@ class DeployOvercloud(command.Command):
def _keystone_init(self, overcloud_endpoint, overcloud_ip_or_fqdn,
parsed_args, stack):
keystone_admin_ip = utils.get_endpoint('KeystoneAdmin', stack)
keystone_admin_ip = utils.unbracket_ipv6(keystone_admin_ip)
keystone_internal_ip = utils.get_endpoint('KeystoneInternal', stack)
keystone_internal_ip = utils.unbracket_ipv6(keystone_internal_ip)
tls_enabled = self._is_tls_enabled(overcloud_endpoint)
keystone_tls_host = None
if tls_enabled: