From 10aa2b88796493e8769b44b0cd14343b2e3390cb Mon Sep 17 00:00:00 2001
From: Victor Seva <vseva@sipwise.com>
Date: Mon, 25 Aug 2014 16:28:10 +0200
Subject: [PATCH] MT#8773 [CARRIER] get ngcpip[12] options from mgmt

We need to know what is the proper IP for sp1/sp2

Change-Id: Ib2fa96d54fa04d6f0eb0eca3dee635325d1a2748
---
 deployment.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/deployment.sh b/deployment.sh
index fec71cc..7226ff0 100755
--- a/deployment.sh
+++ b/deployment.sh
@@ -622,6 +622,15 @@ fi
 [ -n "$EXTERNAL_DEV" ] || EXTERNAL_DEV=$INSTALL_DEV
 [ -n "$EXTERNAL_IP" ] || EXTERNAL_IP=$INSTALL_IP
 
+# needed for carrier
+if "$RETRIEVE_MGMT_CONFIG" ; then
+  logit "Retrieving ha_int IPs configuration from management server"
+  wget --timeout=30 -O "/tmp/hosts" "${MANAGEMENT_IP}:3000/hostconfig/${TARGET_HOSTNAME}"
+  IP1=$(awk '/sp1/ { print $1 }' /tmp/hosts) || IP1=$DEFAULT_IP1
+  IP2=$(awk '/sp2/ { print $1 }' /tmp/hosts) || IP2=$DEFAULT_IP2
+  logit "ha_int sp1: $IP1 sp2: $IP2"
+fi
+
 # hopefully set via bootoption/cmdline,
 # otherwise fall back to hopefully-safe-defaults
 # make sure the internal device (configured later) is not statically assigned,