From 7834ef4f3ec8c0a95f0d4011a1e5fed462f63221 Mon Sep 17 00:00:00 2001 From: Cole Walker Date: Thu, 11 Feb 2021 18:09:56 -0500 Subject: [PATCH] Fix rabbit URI to allow ipv6 and ipv4 Startup scripts were failing on ipv6 addresses because the URI format would be incorrect. Adding the square brackets allows for both address families to work, as well as working with hostnames. Story: 2008529 Task: 41820 Signed-off-by: Cole Walker Change-Id: Ibee9fec3b14869f8bb3d87a30e13b6a968f9b79a --- .../resources/scripts/init/locationservice_start.sh | 9 +++++---- .../resources/scripts/init/ptptracking_start.sh | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh index 9053715..df7dc0f 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/locationservice_start.sh @@ -37,8 +37,9 @@ rabbituser = os.environ.get("REGISTRATION_USER",'admin') rabbitpasswd = os.environ.get("REGISTRATION_PASS",'admin') rabbitip = "registration.{0}.svc.cluster.local".format(THIS_NAMESPACE) rabbitport = os.environ.get("REGISTRATION_PORT",'5672') -# 'rabbit://admin:admin@172.16.192.78:5672/' -rabbitendpoint = "rabbit://{0}:{1}@{2}:{3}".format( +# 'rabbit://admin:admin@[127.0.0.1]:5672/' +# 'rabbit://admin:admin@[::1]:5672/' +rabbitendpoint = "rabbit://{0}:{1}@[{2}]:{3}".format( rabbituser, rabbitpasswd, rabbitip, rabbitport) class LocationInfoEndpoint(object): @@ -94,7 +95,7 @@ rabbituser = os.environ.get("REGISTRATION_USER",'admin') rabbitpasswd = os.environ.get("REGISTRATION_PASS",'admin') rabbitip = "registration.{0}.svc.cluster.local".format(THIS_NAMESPACE) rabbitport = os.environ.get("REGISTRATION_PORT",'5672') -rabbitendpoint = "rabbit://{0}:{1}@{2}:{3}".format( +rabbitendpoint = "rabbit://{0}:{1}@[{2}]:{3}".format( rabbituser, rabbitpasswd, rabbitip, rabbitport) oslo_messaging.set_transport_defaults('notification_exchange') @@ -149,7 +150,7 @@ REGISTRATION_HOST = os.environ.get("REGISTRATION_HOST",'registration.notificatio THIS_NODE_NAME = os.environ.get("THIS_NODE_NAME",'controller-0') THIS_POD_IP = os.environ.get("THIS_POD_IP",'127.0.0.1') -REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@{2}:{3}'.format( +REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( REGISTRATION_USER, REGISTRATION_PASS, REGISTRATION_HOST, REGISTRATION_PORT) sqlalchemy_conf_json=json.dumps({}) diff --git a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.sh b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.sh index d71b616..cfbeab2 100644 --- a/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.sh +++ b/stx-ptp-notification-helm/stx-ptp-notification-helm/helm-charts/ptp-notification/resources/scripts/init/ptptracking_start.sh @@ -42,14 +42,16 @@ REGISTRATION_PASS = os.environ.get("REGISTRATION_PASS", "admin") REGISTRATION_PORT = os.environ.get("REGISTRATION_PORT", "5672") REGISTRATION_HOST = os.environ.get("REGISTRATION_HOST",'registration.notification.svc.cluster.local') -REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@{2}:{3}'.format( +# 'rabbit://admin:admin@[127.0.0.1]:5672/' +# 'rabbit://admin:admin@[::1]:5672/' +REGISTRATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( REGISTRATION_USER, REGISTRATION_PASS, REGISTRATION_HOST, REGISTRATION_PORT) NOTIFICATION_BROKER_USER = os.environ.get("NOTIFICATIONSERVICE_USER", "admin") NOTIFICATION_BROKER_PASS = os.environ.get("NOTIFICATIONSERVICE_PASS", "admin") NOTIFICATION_BROKER_PORT = os.environ.get("NOTIFICATIONSERVICE_PORT", "5672") -NOTIFICATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@{2}:{3}'.format( +NOTIFICATION_TRANSPORT_ENDPOINT = 'rabbit://{0}:{1}@[{2}]:{3}'.format( NOTIFICATION_BROKER_USER, NOTIFICATION_BROKER_PASS, THIS_POD_IP, NOTIFICATION_BROKER_PORT) PTP_DEVICE_SIMULATED = os.environ.get("PTP_DEVICE_SIMULATED", False) @@ -80,6 +82,7 @@ sqlalchemy_conf = { 'pool_recycle' : 3600, 'encoding' : 'utf-8' } + sqlalchemy_conf_json = json.dumps(sqlalchemy_conf) default_daemoncontrol = DaemonControl(sqlalchemy_conf_json, json.dumps(context))