2011-10-20 10:24:50 -07:00
|
|
|
#!/usr/bin/env bash
|
2012-02-24 10:44:18 -06:00
|
|
|
#
|
2016-02-17 06:23:36 -05:00
|
|
|
# source openrc [username] [projectname]
|
2012-02-24 10:44:18 -06:00
|
|
|
#
|
2016-02-17 06:23:36 -05:00
|
|
|
# Configure a set of credentials for $PROJECT/$USERNAME:
|
|
|
|
# Set OS_PROJECT_NAME to override the default project 'demo'
|
2012-03-28 15:23:58 -04:00
|
|
|
# Set OS_USERNAME to override the default user name 'demo'
|
2012-02-24 10:44:18 -06:00
|
|
|
# Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
|
|
|
|
|
|
|
|
if [[ -n "$1" ]]; then
|
2012-03-28 15:23:58 -04:00
|
|
|
OS_USERNAME=$1
|
2012-02-24 10:44:18 -06:00
|
|
|
fi
|
|
|
|
if [[ -n "$2" ]]; then
|
2016-02-17 06:23:36 -05:00
|
|
|
OS_PROJECT_NAME=$2
|
2012-02-24 10:44:18 -06:00
|
|
|
fi
|
2011-10-20 10:24:50 -07:00
|
|
|
|
2012-03-08 00:33:54 -06:00
|
|
|
# Find the other rc files
|
2013-10-24 18:51:44 -04:00
|
|
|
RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
|
2012-03-08 00:33:54 -06:00
|
|
|
|
2013-06-01 00:54:47 -04:00
|
|
|
# Import common functions
|
|
|
|
source $RC_DIR/functions
|
|
|
|
|
2011-10-20 10:24:50 -07:00
|
|
|
# Load local configuration
|
2012-03-08 00:33:54 -06:00
|
|
|
source $RC_DIR/stackrc
|
2011-10-20 10:24:50 -07:00
|
|
|
|
2012-12-10 16:47:36 -06:00
|
|
|
# Load the last env variables if available
|
2013-03-29 10:15:36 -05:00
|
|
|
if [[ -r $RC_DIR/.stackenv ]]; then
|
|
|
|
source $RC_DIR/.stackenv
|
2018-04-03 15:16:30 +00:00
|
|
|
export OS_CACERT
|
2012-12-10 16:47:36 -06:00
|
|
|
fi
|
|
|
|
|
2012-11-29 11:47:58 -06:00
|
|
|
# Get some necessary configuration
|
|
|
|
source $RC_DIR/lib/tls
|
|
|
|
|
2024-05-28 13:33:32 +01:00
|
|
|
# Minimal configuration
|
|
|
|
export OS_AUTH_TYPE=password
|
2016-02-17 06:23:36 -05:00
|
|
|
export OS_PROJECT_NAME=${OS_PROJECT_NAME:-demo}
|
2012-03-28 15:23:58 -04:00
|
|
|
export OS_USERNAME=${OS_USERNAME:-demo}
|
2016-03-01 04:43:31 +00:00
|
|
|
export OS_PASSWORD=${ADMIN_PASSWORD:-secret}
|
2014-02-28 14:15:19 +01:00
|
|
|
export OS_REGION_NAME=${REGION_NAME:-RegionOne}
|
|
|
|
|
2015-06-16 13:14:31 -04:00
|
|
|
# Set the host API endpoint. This will default to HOST_IP if SERVICE_IP_VERSION
|
|
|
|
# is 4, else HOST_IPV6 if it's 6. SERVICE_HOST may also be used to specify the
|
|
|
|
# endpoint, which is convenient for some localrc configurations. Additionally,
|
|
|
|
# some exercises call Glance directly. On a single-node installation, Glance
|
|
|
|
# should be listening on a local IP address, depending on the setting of
|
|
|
|
# SERVICE_IP_VERSION. If its running elsewhere, it can be set here.
|
|
|
|
if [[ $SERVICE_IP_VERSION == 6 ]]; then
|
|
|
|
HOST_IPV6=${HOST_IPV6:-::1}
|
|
|
|
SERVICE_HOST=${SERVICE_HOST:-[$HOST_IPV6]}
|
|
|
|
GLANCE_HOST=${GLANCE_HOST:-[$HOST_IPV6]}
|
|
|
|
else
|
|
|
|
HOST_IP=${HOST_IP:-127.0.0.1}
|
|
|
|
SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
|
|
|
|
GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
|
|
|
|
fi
|
|
|
|
|
2017-08-09 01:43:00 -07:00
|
|
|
# If you don't have a working .stackenv, this is the backup position
|
2020-07-06 18:42:30 +00:00
|
|
|
KEYSTONE_BACKUP=$SERVICE_PROTOCOL://$SERVICE_HOST:5000
|
2019-04-10 10:33:39 +00:00
|
|
|
KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_URI:-$KEYSTONE_BACKUP}
|
2017-04-20 15:11:43 -04:00
|
|
|
|
2019-04-10 10:33:39 +00:00
|
|
|
export OS_AUTH_URL=${OS_AUTH_URL:-$KEYSTONE_SERVICE_URI}
|
2012-11-29 11:47:58 -06:00
|
|
|
|
2024-07-08 18:02:25 +02:00
|
|
|
export OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-"default"}
|
|
|
|
export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"}
|
2016-04-01 10:53:13 +02:00
|
|
|
|
2015-05-05 15:00:03 -07:00
|
|
|
# Set OS_CACERT to a default CA certificate chain if it exists.
|
|
|
|
if [[ ! -v OS_CACERT ]] ; then
|
|
|
|
DEFAULT_OS_CACERT=$INT_CA_DIR/ca-chain.pem
|
|
|
|
# If the file does not exist, this may confuse preflight sanity checks
|
|
|
|
if [ -e $DEFAULT_OS_CACERT ] ; then
|
|
|
|
export OS_CACERT=$DEFAULT_OS_CACERT
|
|
|
|
fi
|
|
|
|
fi
|
2011-10-20 10:24:50 -07:00
|
|
|
|
2013-08-20 21:53:30 -07:00
|
|
|
# Currently cinderclient needs you to specify the *volume api* version. This
|
|
|
|
# needs to match the config of your catalog returned by Keystone.
|
2018-05-07 16:43:56 -05:00
|
|
|
export CINDER_VERSION=${CINDER_VERSION:-3}
|
2013-08-20 21:53:30 -07:00
|
|
|
export OS_VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-$CINDER_VERSION}
|