aboutsummaryrefslogtreecommitdiffstats
path: root/test/ete/scripts/install_openstack_cli.sh
blob: 408aae6974d110df54dbd5e2b728a82bfdbb60a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

if ! hash openstack jq
then
    echo "ERROR: Required commands not found; please install openstack CLI and jq."
    exit 2
fi

if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ]
then
    echo "ERROR: OpenStack environment variables not set.  Please source your OpenStack RC script first."
    exit 1
fi

if [ -z "$WORKSPACE" ]; then
    export WORKSPACE=`git rev-parse --show-toplevel`
fi

if [ -f ${WORKSPACE}/env.properties ]; then
    source ${WORKSPACE}/env.properties
fi

if [ -z "$ONAP_WORKDIR" ]; then
    ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir)
    echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties
fi
echo "ONAP_WORKDIR=${ONAP_WORKDIR}"
if [ ! -d ${ONAP_WORKDIR}/demo ]; then
    git clone https://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo
else
    pushd ${ONAP_WORKDIR}/demo
    git pull
    popd
fi