Set environment variables for protonclient

protonclient requires user credentials to be set up as environment
variable when keystone is enable for authentication. Add an openrc
file to help setting up this variables.

Change-Id: Idea1112a61b030d869371642575147cf6aa46d18
This commit is contained in:
JinLi 2017-07-11 15:31:54 -07:00
parent 0d9ad1373c
commit 081c86f494
2 changed files with 76 additions and 0 deletions

View File

@ -189,6 +189,8 @@ Configuration
The /etc/proton/proton.conf file can be used to configure the authentication details. A sample
configuration is shown below. Change 127.0.0.1 to your keystone endpoint.
.. code-block:: conf
[api]
auth_strategy = keystone
@ -205,6 +207,21 @@ configuration is shown below. Change 127.0.0.1 to your keystone endpoint.
[oslo_policy]
policy_file = /etc/proton/policy.json
Set Environment Variables
~~~~~~~~~~~~~~~~~~~~~~~~~
If Keystone is enabled for authentication, some environment variables will need
to be set up in order for protonclient commands to work properly. Modify the openrc
file in gluon home directory with the appropriate value for you Keystone endpoint.
A sample is shown below.
Then run ``source openrc <project_name> <user_name> <user_password>``to set these variables.
.. code-block:: bash
#
# set Keystone endpoint
#
export OS_AUTH_URL="http://192.168.56.101:5000"
Appendix
--------
Configuring identity details for Keystone, change 10.0.2.15 to your gluon endpoint:

59
openrc Normal file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env bash
#
# source openrc
#
# Configure a set of credentials for $PROJECT/$USERNAME:
# set OS_AUTH_URL to Keystone end point
# Set OS_PROJECT_NAME to openstack project name
# Set OS_USERNAME to openstack user name
# Set ADMIN_PASSWORD to openstack password
# If using devstack:
# set both OS_USERNAME and OS_TENANT_NAME to 'admin' or 'demo'
# Example config for devstack:
# export OS_AUTH_URL="http://192.168.56.101:5000"
# export OS_TENANT_NAME="admin"
# export OS_USERNAME="admin"
# export OS_PASSWORD="ubuntu"
#
# set Keystone endpoint
#
export OS_AUTH_URL="<keystone endpoint>:5000"
#
# set openstack credentials
#
if [[ $# -ne 3 ]]; then
echo "wrong number of arguments!"
echo "enter openstack credentials in the following order:"
echo "source openrc <project_name> <user_name> <user_password>"
return
else
if [[ -n "$1" ]]; then
OS_PROJECT_NAME=$1
else
echo "Openstack project name cannot be an empty string"
return
fi
if [[ -n "$2" ]]; then
OS_USERNAME=$2
else
echo "Openstack user name cannot be an empty string"
return
fi
if [[ -n "$3" ]]; then
OS_PASSWORD=$3
else
echo "Openstack password cannot be an empty string"
return
fi
export OS_TENANT_NAME=${OS_PROJECT_NAME}
export OS_USERNAME=${OS_USERNAME}
export OS_PASSWORD=${OS_PASSWORD}
fi