openrc
6ab10d46
 #!/usr/bin/env bash
4807df8e
 #
 # source openrc [username] [tenantname]
 #
 # Configure a set of credentials for $TENANT/$USERNAME:
08e07fb4
 #   Set OS_TENANT_NAME to override the default tenant 'demo'
 #   Set OS_USERNAME to override the default user name 'demo'
4807df8e
 #   Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
 
 # NOTE: support for the old NOVA_* novaclient environment variables has
 # been removed.
 
 if [[ -n "$1" ]]; then
08e07fb4
     OS_USERNAME=$1
4807df8e
 fi
 if [[ -n "$2" ]]; then
08e07fb4
     OS_TENANT_NAME=$2
4807df8e
 fi
6ab10d46
 
0bd2410d
 # Find the other rc files
388e36c9
 RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
0bd2410d
 
ebdd61d1
 # Import common functions
 source $RC_DIR/functions
 
6ab10d46
 # Load local configuration
0bd2410d
 source $RC_DIR/stackrc
6ab10d46
 
33cb4303
 # Load the last env variables if available
3ac95355
 if [[ -r $RC_DIR/.stackenv ]]; then
     source $RC_DIR/.stackenv
33cb4303
 fi
 
c83a7e12
 # Get some necessary configuration
 source $RC_DIR/lib/tls
 
4807df8e
 # The introduction of Keystone to the OpenStack ecosystem has standardized the
 # term **tenant** as the entity that owns resources.  In some places references
 # still exist to the original Nova term **project** for this use.  Also,
4640026c
 # **tenant_name** is preferred to **tenant_id**.
08e07fb4
 export OS_TENANT_NAME=${OS_TENANT_NAME:-demo}
4807df8e
 
 # In addition to the owning entity (tenant), nova stores the entity performing
 # the action as the **user**.
08e07fb4
 export OS_USERNAME=${OS_USERNAME:-demo}
4807df8e
 
 # With Keystone you pass the keystone password instead of an api key.
 # Recent versions of novaclient use OS_PASSWORD instead of NOVA_API_KEYs
 # or NOVA_PASSWORD.
 export OS_PASSWORD=${ADMIN_PASSWORD:-secrete}
 
7b0f002b
 # Don't put the key into a keyring by default. Testing for development is much
 # easier with this off.
 export OS_NO_CACHE=${OS_NO_CACHE:-1}
 
0abde393
 # Region
 export OS_REGION_NAME=${REGION_NAME:-RegionOne}
 
1097c7ca
 # Set api HOST_IP endpoint.  SERVICE_HOST may also be used to specify the endpoint,
 # which is convenient for some localrc configurations.
f75d848e
 HOST_IP=${HOST_IP:-127.0.0.1}
1097c7ca
 SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
c83a7e12
 SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
bd24a8d0
 KEYSTONE_AUTH_PROTOCOL=${KEYSTONE_AUTH_PROTOCOL:-$SERVICE_PROTOCOL}
0abde393
 KEYSTONE_AUTH_HOST=${KEYSTONE_AUTH_HOST:-$SERVICE_HOST}
6ab10d46
 
ce05e032
 # Some exercises call glance directly.  On a single-node installation, Glance
 # should be listening on HOST_IP.  If its running elsewhere, it can be set here
 GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
 
300e1bf2
 # Identity API version
 export OS_IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
 
2b69f236
 # Authenticating against an OpenStack cloud using Keystone returns a **Token**
4807df8e
 # and **Service Catalog**.  The catalog contains the endpoints for all services
 # the user/tenant has access to - including nova, glance, keystone, swift, ...
 # We currently recommend using the 2.0 *identity api*.
6ab10d46
 #
0abde393
 export OS_AUTH_URL=$KEYSTONE_AUTH_PROTOCOL://$KEYSTONE_AUTH_HOST:5000/v${OS_IDENTITY_API_VERSION}
c83a7e12
 
 # Set the pointer to our CA certificate chain.  Harmless if TLS is not used.
bd24a8d0
 export OS_CACERT=${OS_CACERT:-$INT_CA_DIR/ca-chain.pem}
6ab10d46
 
 # Currently novaclient needs you to specify the *compute api* version.  This
 # needs to match the config of your catalog returned by Keystone.
d81ed031
 export NOVA_VERSION=${NOVA_VERSION:-1.1}
4807df8e
 # In the future this will change names:
 export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
bd8ac01b
 
 # Currently cinderclient needs you to specify the *volume api* version. This
 # needs to match the config of your catalog returned by Keystone.
 export CINDER_VERSION=${CINDER_VERSION:-2}
 export OS_VOLUME_API_VERSION=${OS_VOLUME_API_VERSION:-$CINDER_VERSION}