e49bc6ba29be914421b9a9673dc64cb5672be684
[bottlenecks.git] / rubbos / rubbos_scripts / 1-1-1 / scripts / env_preparation.sh
1 #!/bin/bash
2 ###############################################################################
3 # Copyright (c) 2015 Huawei Tech.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -e
12
13 RELENG_REPO= https://gerrit.opnfv.org/gerrit/releng
14 RELENG_REPO_DIR=/home/opnfv/repos/releng
15 RELENG_BRANCH=master # branch, tag, sha1 or refspec
16
17 INSTALLER_TYPE=fuel
18 INSTALLER_IP=10.20.0.2
19
20 POD_NAME=opnfv-jump-2
21 EXTERNAL_NET=net04_ext
22
23 echo "INFO: Creating openstack credentials .."
24
25 # Create openstack credentials
26 $RELENG_REPO_DIR/utils/fetch_os_creds.sh \
27     -d /tmp/openrc \
28     -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}
29
30 source /tmp/openrc
31
32 # FIXME: Temporary OPNFV playground hack
33 if [ "$INSTALLER_TYPE" == "fuel" ]; then
34     ssh_opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
35     if sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \
36         fuel environment --env 1 | grep opnfv-virt; then
37         echo "INFO: applying OPNFV playground hack"
38         export OS_ENDPOINT_TYPE='publicURL'
39     fi
40 fi
41
42 export EXTERNAL_NET INSTALLER_TYPE POD_NAME