blob: e800abeb3d20d421a8dd59f6eb87a32bfa601980 [file] [log] [blame]
Anthony Young6ab10d42011-10-20 10:24:50 -07001#!/usr/bin/env bash
Dean Troyer4807df82012-02-24 10:44:18 -06002#
Sean Dague7580a0c2016-02-17 06:23:36 -05003# source openrc [username] [projectname]
Dean Troyer4807df82012-02-24 10:44:18 -06004#
Sean Dague7580a0c2016-02-17 06:23:36 -05005# Configure a set of credentials for $PROJECT/$USERNAME:
6# Set OS_PROJECT_NAME to override the default project 'demo'
Russell Bryant08e07fb2012-03-28 15:23:58 -04007# Set OS_USERNAME to override the default user name 'demo'
Dean Troyer4807df82012-02-24 10:44:18 -06008# Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
9
Dean Troyer4807df82012-02-24 10:44:18 -060010if [[ -n "$1" ]]; then
Russell Bryant08e07fb2012-03-28 15:23:58 -040011 OS_USERNAME=$1
Dean Troyer4807df82012-02-24 10:44:18 -060012fi
13if [[ -n "$2" ]]; then
Sean Dague7580a0c2016-02-17 06:23:36 -050014 OS_PROJECT_NAME=$2
Dean Troyer4807df82012-02-24 10:44:18 -060015fi
Anthony Young6ab10d42011-10-20 10:24:50 -070016
Dean Troyer0bd24102012-03-08 00:33:54 -060017# Find the other rc files
Peter Feiner388e36c2013-10-24 18:51:44 -040018RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
Dean Troyer0bd24102012-03-08 00:33:54 -060019
Jeff Peelerebdd61d2013-06-01 00:54:47 -040020# Import common functions
21source $RC_DIR/functions
22
Anthony Young6ab10d42011-10-20 10:24:50 -070023# Load local configuration
Dean Troyer0bd24102012-03-08 00:33:54 -060024source $RC_DIR/stackrc
Anthony Young6ab10d42011-10-20 10:24:50 -070025
Dean Troyer33cb4302012-12-10 16:47:36 -060026# Load the last env variables if available
Dean Troyer3ac95352013-03-29 10:15:36 -050027if [[ -r $RC_DIR/.stackenv ]]; then
28 source $RC_DIR/.stackenv
Jens Harbott87c0de52018-04-03 15:16:30 +000029 export OS_CACERT
Dean Troyer33cb4302012-12-10 16:47:36 -060030fi
31
Dean Troyerc83a7e12012-11-29 11:47:58 -060032# Get some necessary configuration
33source $RC_DIR/lib/tls
34
Stephen Finucane9fff87f2024-05-28 13:33:32 +010035# Minimal configuration
36export OS_AUTH_TYPE=password
Sean Dague7580a0c2016-02-17 06:23:36 -050037export OS_PROJECT_NAME=${OS_PROJECT_NAME:-demo}
Russell Bryant08e07fb2012-03-28 15:23:58 -040038export OS_USERNAME=${OS_USERNAME:-demo}
Balagopal7ed812c2016-03-01 04:43:31 +000039export OS_PASSWORD=${ADMIN_PASSWORD:-secret}
Bartosz Górski0abde392014-02-28 14:15:19 +010040export OS_REGION_NAME=${REGION_NAME:-RegionOne}
41
Brian Haley5d04db22015-06-16 13:14:31 -040042# Set the host API endpoint. This will default to HOST_IP if SERVICE_IP_VERSION
43# is 4, else HOST_IPV6 if it's 6. SERVICE_HOST may also be used to specify the
44# endpoint, which is convenient for some localrc configurations. Additionally,
45# some exercises call Glance directly. On a single-node installation, Glance
46# should be listening on a local IP address, depending on the setting of
47# SERVICE_IP_VERSION. If its running elsewhere, it can be set here.
48if [[ $SERVICE_IP_VERSION == 6 ]]; then
49 HOST_IPV6=${HOST_IPV6:-::1}
50 SERVICE_HOST=${SERVICE_HOST:-[$HOST_IPV6]}
51 GLANCE_HOST=${GLANCE_HOST:-[$HOST_IPV6]}
52else
53 HOST_IP=${HOST_IP:-127.0.0.1}
54 SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
55 GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
56fi
57
zhangbailin32608da2017-08-09 01:43:00 -070058# If you don't have a working .stackenv, this is the backup position
Abhishek Kekanef8dbfd32020-07-06 18:42:30 +000059KEYSTONE_BACKUP=$SERVICE_PROTOCOL://$SERVICE_HOST:5000
Jens Harbott32c00892019-04-10 10:33:39 +000060KEYSTONE_SERVICE_URI=${KEYSTONE_SERVICE_URI:-$KEYSTONE_BACKUP}
Sean Dague9bfabc62017-04-20 15:11:43 -040061
Jens Harbott32c00892019-04-10 10:33:39 +000062export OS_AUTH_URL=${OS_AUTH_URL:-$KEYSTONE_SERVICE_URI}
Dean Troyerc83a7e12012-11-29 11:47:58 -060063
Dr. Jens Harbotteb0ac1d2024-07-08 18:02:25 +020064export OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-"default"}
65export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"}
Daniel Gonzalez336390f2016-04-01 10:53:13 +020066
Clint Byrum52a3beb2015-05-05 15:00:03 -070067# Set OS_CACERT to a default CA certificate chain if it exists.
68if [[ ! -v OS_CACERT ]] ; then
69 DEFAULT_OS_CACERT=$INT_CA_DIR/ca-chain.pem
70 # If the file does not exist, this may confuse preflight sanity checks
71 if [ -e $DEFAULT_OS_CACERT ] ; then
72 export OS_CACERT=$DEFAULT_OS_CACERT
73 fi
74fi