2 ###############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
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 ##############################################################################
11 source ${BASEDIR}/../common.sh
13 info "============ Preparing bottlenecks environment ==========="
15 # definition of available installer names
16 INSTALLERS=(fuel compass apex joid)
18 if [ ! -f ${BOTTLENECKS_REPO_DIR}/config/openstack.creds ]; then
19 # If credentials file is not given, check if environment variables are set
20 # to get the creds using fetch_os_creds.sh later on
21 info "Checking environment variables INSTALLER_TYPE and INSTALLER_IP"
22 if [ -z ${INSTALLER_TYPE} ]; then
23 error "Environment variable 'INSTALLER_TYPE' is not defined."
24 elif [[ ${INSTALLERS[@]} =~ ${INSTALLER_TYPE} ]]; then
25 info "INSTALLER_TYPE env variable found: ${INSTALLER_TYPE}"
27 error "Invalid environment variable INSTALLER_TYPE=${INSTALLER_TYPE}"
30 if [ -z ${INSTALLER_IP} ]; then
31 error "Environment variable 'INSTALLER_IP' is not defined."
33 info "INSTALLER_IP env variable found: ${INSTALLER_IP}"
36 # Create Openstack credentials file
37 # $creds is an env varialbe in the docker container pointing to
38 # /home/opnfv/bottlenecks/config/openstack.creds
39 if [ ! -f ${creds} ]; then
40 ${REPOS_DIR}/releng/utils/fetch_os_creds.sh -d ${creds} \
41 -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}
43 if [ $retval != 0 ]; then
44 error "Cannot retrieve credentials file from installation. Check logs."
48 info "OpenStack credentials file given to the docker"
51 # If we use SSL, by default use option OS_INSECURE=true which means that
52 # the cacert will be self-signed
53 if grep -Fq "OS_CACERT" ${creds}; then
54 echo "OS_INSECURE=true">>${creds};