-
Notifications
You must be signed in to change notification settings - Fork 33
/
openrc
27 lines (24 loc) · 1.04 KB
/
openrc
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
if [ ! -z $JUJU_MODEL ]; then
_juju_model_arg="-m $JUJU_MODEL"
fi
_keystone_major_version=$(juju status $_juju_model_arg keystone --format yaml| \
awk '/^ version:/ {print $2; exit}' | cut -f1 -d\.)
_keystone_preferred_api_version=$(juju config $_juju_model_arg keystone preferred-api-version)
# The per user snap data directory is not created until first execution of snap
openstack --version 2>&1 > /dev/null || true
if [ -d ~/snap/openstackclients/common/ ]; then
# When using the openstackclients confined snap the certificate has to be
# placed in a location reachable by the clients in the snap.
_root_ca=~/snap/openstackclients/common/root-ca.crt
else
_root_ca=/tmp/root-ca.crt
fi
juju run $_juju_model_arg --unit vault/leader 'leader-get root-ca' > $_root_ca 2>/dev/null
if [ $_keystone_major_version -ge 13 -o \
"$_keystone_preferred_api_version" = '3' ]; then
echo Using Keystone v3 API
. $(dirname ${BASH_SOURCE[0]})/openrcv3_project
else
echo Using Keystone v2.0 API
. $(dirname ${BASH_SOURCE[0]})/openrcv2
fi