Browse code

Update openrc to focus on current OS_* environment variables

* Support for NOVA_* variables removed
* Support for username and tenant on command line added

Change-Id: Icd50e8bd06eaeedbc4bfd10a67ad0329d72d5756

Dean Troyer authored on 2012/02/25 01:44:18
Showing 1 changed files
... ...
@@ -1,8 +1,40 @@
1 1
 #!/usr/bin/env bash
2
+#
3
+# source openrc [username] [tenantname]
4
+#
5
+# Configure a set of credentials for $TENANT/$USERNAME:
6
+#   Set TENANT to override the default tenant 'demo'
7
+#   Set USERNAME to override the default user name 'demo'
8
+#   Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
9
+
10
+# NOTE: support for the old NOVA_* novaclient environment variables has
11
+# been removed.
12
+
13
+if [[ -n "$1" ]]; then
14
+    USERNAME=$1
15
+fi
16
+if [[ -n "$2" ]]; then
17
+    TENANT=$2
18
+fi
2 19
 
3 20
 # Load local configuration
4 21
 source ./stackrc
5 22
 
23
+# The introduction of Keystone to the OpenStack ecosystem has standardized the
24
+# term **tenant** as the entity that owns resources.  In some places references
25
+# still exist to the original Nova term **project** for this use.  Also,
26
+# **tenant_name** is prefered to **tenant_id**.
27
+export OS_TENANT_NAME=${TENANT:-demo}
28
+
29
+# In addition to the owning entity (tenant), nova stores the entity performing
30
+# the action as the **user**.
31
+export OS_USERNAME=${USERNAME:-demo}
32
+
33
+# With Keystone you pass the keystone password instead of an api key.
34
+# Recent versions of novaclient use OS_PASSWORD instead of NOVA_API_KEYs
35
+# or NOVA_PASSWORD.
36
+export OS_PASSWORD=${ADMIN_PASSWORD:-secrete}
37
+
6 38
 # Set api HOST_IP endpoint.  SERVICE_HOST may also be used to specify the endpoint,
7 39
 # which is convenient for some localrc configurations.
8 40
 HOST_IP=${HOST_IP:-127.0.0.1}
... ...
@@ -12,45 +44,20 @@ SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
12 12
 # should be listening on HOST_IP.  If its running elsewhere, it can be set here
13 13
 GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
14 14
 
15
-# novaclient now supports the new OS_* configuration variables in addition to
16
-# the older NOVA_* variables.  Set them both for now...
17
-
18
-# Nova original used project_id as the *account* that owned resources (servers,
19
-# ip address, ...)   With the addition of Keystone we have standardized on the
20
-# term **tenant** as the entity that owns the resources.  **novaclient** still
21
-# uses the old deprecated terms project_id.  Note that this field should now be
22
-# set to tenant_name, not tenant_id.
23
-export NOVA_PROJECT_ID=${TENANT:-demo}
24
-export OS_TENANT_NAME=${NOVA_PROJECT_ID}
25
-
26
-# In addition to the owning entity (tenant), nova stores the entity performing
27
-# the action as the **user**.
28
-export NOVA_USERNAME=${USERNAME:-demo}
29
-export OS_USERNAME=${NOVA_USERNAME}
30
-
31
-# With Keystone you pass the keystone password instead of an api key.
32
-# Recent versions of novaclient use NOVA_PASSWORD instead of NOVA_API_KEY
33
-# The most recent versions of novaclient use OS_PASSWORD in addition to NOVA_PASSWORD
34
-export NOVA_PASSWORD=${ADMIN_PASSWORD:-secrete}
35
-export OS_PASSWORD=${NOVA_PASSWORD}
36
-
37
-# With the addition of Keystone, to use an openstack cloud you should
38
-# authenticate against keystone, which returns a **Token** and **Service
39
-# Catalog**.  The catalog contains the endpoint for all services the user/tenant
40
-# has access to - including nova, glance, keystone, swift, ...  We currently
41
-# recommend using the 2.0 *auth api*.
15
+# Authenticating against an Openstack cloud using Keystone returns a **Token**
16
+# and **Service Catalog**.  The catalog contains the endpoints for all services
17
+# the user/tenant has access to - including nova, glance, keystone, swift, ...
18
+# We currently recommend using the 2.0 *identity api*.
42 19
 #
43
-# *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0.  We
20
+# *NOTE*: Using the 2.0 *identity api* does not mean that compute api is 2.0.  We
44 21
 # will use the 1.1 *compute api*
45
-export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0}
46
-export OS_AUTH_URL=${NOVA_URL}
22
+export OS_AUTH_URL=http://$SERVICE_HOST:5000/v2.0
47 23
 
48 24
 # Currently novaclient needs you to specify the *compute api* version.  This
49 25
 # needs to match the config of your catalog returned by Keystone.
50 26
 export NOVA_VERSION=${NOVA_VERSION:-1.1}
51
-
52
-# FIXME - why does this need to be specified?
53
-export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne}
27
+# In the future this will change names:
28
+export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
54 29
 
55 30
 # Set the ec2 url so euca2ools works
56 31
 export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud}