Fix compass public vip fetch bug in Newton 97/26597/1
authorQiLiang <liangqi1@huawei.com>
Fri, 30 Dec 2016 03:27:30 +0000 (19:27 -0800)
committerQiLiang <liangqi1@huawei.com>
Fri, 30 Dec 2016 03:37:14 +0000 (19:37 -0800)
Error log:
More than one endpoint exists with the name 'identity'.
fetch_os_creds.info: public_ip:

Change-Id: Ie7c8eeec5e84de4c38a17b4e718be65f36c562a7
Signed-off-by: QiLiang <liangqi1@huawei.com>
utils/fetch_os_creds.sh

index 47fbc91..ecc571d 100755 (executable)
@@ -144,9 +144,17 @@ elif [ "$installer_type" == "compass" ]; then
     sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null
 
     info "This file contains the mgmt keystone API, we need the public one for our rc file"
-    public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \
-        "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \
-        | grep publicurl | awk '{print $4}')
+    grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1
+    if [ $?  -eq 0 ] ; then
+        public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \
+            "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \
+            | grep publicurl | awk '{print $4}')
+    else
+        public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \
+            "ssh ${controller_ip} 'source /opt/admin-openrc.sh; \
+                 openstack endpoint list --interface public --service identity '" \
+            | grep identity | awk '{print $14}')
+    fi
     info "public_ip: $public_ip"