summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-07-06 06:37:41 +0000
committerLinda Wang <wangwulin@huawei.com>2017-07-06 06:49:01 +0000
commit832c9c2eded3f7d93479b2c8e56fd17d304ab569 (patch)
treecc583b761f207a5b4ecbf594cf3d6891552d095d
parentbb24c3d6c42c7b74ae8ea2fb9f390ff1f7fd7dbf (diff)
Compass: add retrieving OS credentials for Containers
Compass has changed the mechanism of deployment (Containers) in master, so we adjust the way to fetch the OS credentials file. Change-Id: If126ac9b081589c21466b59eae05b107bf6dc425 Signed-off-by: Linda Wang <wangwulin@huawei.com>
-rwxr-xr-xutils/fetch_os_creds.sh57
1 files changed, 30 insertions, 27 deletions
diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh
index 993c0b948..b514a91d3 100755
--- a/utils/fetch_os_creds.sh
+++ b/utils/fetch_os_creds.sh
@@ -153,36 +153,39 @@ elif [ "$installer_type" == "apex" ]; then
sudo scp $ssh_options root@$installer_ip:/home/stack/overcloudrc.v3 $dest_path
elif [ "$installer_type" == "compass" ]; then
- verify_connectivity $installer_ip
- controller_ip=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
- 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \
- | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"127.0.0.1\"/) {print $(i+2);break;}}' \
- | grep -oP "\d+.\d+.\d+.\d+")
-
- if [ -z $controller_ip ]; then
- error "The controller $controller_ip is not up. Please check that the POD is correctly deployed."
- fi
-
- info "Fetching rc file from controller $controller_ip..."
- sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \
- "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null
- sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null
+ if [ "${BRANCH}" == "master" ]; then
+ sudo docker cp compass-tasks:/opt/openrc $dest_path &> /dev/null
+ else
+ verify_connectivity $installer_ip
+ controller_ip=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \
+ | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"127.0.0.1\"/) {print $(i+2);break;}}' \
+ | grep -oP "\d+.\d+.\d+.\d+")
- info "This file contains the mgmt keystone API, we need the public one for our rc file"
+ if [ -z $controller_ip ]; then
+ error "The controller $controller_ip is not up. Please check that the POD is correctly deployed."
+ fi
- if grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1 ; 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}')
+ info "Fetching rc file from controller $controller_ip..."
+ sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null
+ 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"
+
+ if grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1 ; 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"
+ swap_to_public $public_ip
fi
- info "public_ip: $public_ip"
- swap_to_public $public_ip
-
elif [ "$installer_type" == "joid" ]; then
# do nothing...for the moment