From 081c86f49481707fb714b4a3df3b628eb4c87595 Mon Sep 17 00:00:00 2001 From: JinLi Date: Tue, 11 Jul 2017 15:31:54 -0700 Subject: [PATCH] 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 --- doc/source/devref/gluon-auth.rst | 17 +++++++++ openrc | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 openrc diff --git a/doc/source/devref/gluon-auth.rst b/doc/source/devref/gluon-auth.rst index a2587ed..c963f84 100644 --- a/doc/source/devref/gluon-auth.rst +++ b/doc/source/devref/gluon-auth.rst @@ -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 ``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: diff --git a/openrc b/openrc new file mode 100644 index 0000000..e29cd03 --- /dev/null +++ b/openrc @@ -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=":5000" + + +# +# set openstack credentials +# +if [[ $# -ne 3 ]]; then + echo "wrong number of arguments!" + echo "enter openstack credentials in the following order:" + echo "source openrc " + 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