Heat Launcher - bracket IPv6 in db connection URI

In the database connection URI ensure IPv6 address is wrapped in
brackets. Without this a port number is assumed and error is raised:
  ERROR: invalid literal for int() with base 10: 'dead:beef:4::3'

Related-Bug: #1983121
Change-Id: I37fda2aa161120369d0e3734b9485c27cb59846c
(cherry picked from commit ec8e134234)
This commit is contained in:
Harald Jensås 2022-07-29 18:44:41 +02:00
parent 54998e2dfd
commit edaeefac65
2 changed files with 5 additions and 1 deletions

View File

@ -43,6 +43,7 @@ from tripleoclient.constants import (DEFAULT_HEAT_CONTAINER,
DEFAULT_TEMPLATES_DIR,
EPHEMERAL_HEAT_POD_NAME)
from tripleoclient.exceptions import HeatPodMessageQueueException
from tripleoclient import utils as oooutils
log = logging.getLogger(__name__)
@ -714,7 +715,7 @@ class HeatPodLauncher(HeatContainerLauncher):
return ('mysql+pymysql://'
'heat:heat@{}/heat?read_default_file='
'/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'.format(
self._get_ctlplane_vip()))
oooutils.bracket_ipv6(self._get_ctlplane_vip())))
def _get_ctlplane_vip(self):
return self._decode(subprocess.check_output(

View File

@ -39,6 +39,9 @@ class TestHeatPodLauncher(base.TestCase):
os.path.join(os.path.dirname(__file__),
'..', '..', 'templates')).start()
self.heat_dir = self.useFixture(fixtures.TempDir()).path
self.bracket_ipv6 = mock.patch(
'tripleoclient.utils.bracket_ipv6').start()
self.bracket_ipv6.return_value = '1.1.1.1'
self.addCleanup(mock.patch.stopall)