Fix openrc source when invoked with bash nounset option
This change fixes the check for the --no-credentials argument to handle
the case where no argument is present and nounset is active, i.e.:
set -o nounset
In this case we default $1 to "" via ${1:-}
Test Plan:
Pass:
- Build and source the /etc/platform/openrc file with and without
arguments. Test with and without the nounset option.
Closes-Bug: 2051549
Change-Id: Iab7f21d26751b024bf58c41b16aac79daa351abf
Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Usage: source this file with parameter "--no_credentials" to avoid exporting
|
||||
# user and password. Also, PS1 variable is not set.
|
||||
|
||||
if [[ $1 == "--no_credentials" ]]; then
|
||||
if [[ "${1:-}" == "--no_credentials" ]]; then
|
||||
no_credentials=true
|
||||
else
|
||||
no_credentials=false
|
||||
@@ -12,7 +12,7 @@ unset OS_SERVICE_TOKEN
|
||||
export OS_ENDPOINT_TYPE=internalURL
|
||||
export CINDER_ENDPOINT_TYPE=internalURL
|
||||
|
||||
if [[ "$no_credentials" == false ]]; then
|
||||
if [[ "${no_credentials}" == false ]]; then
|
||||
export OS_USERNAME=<%= @admin_username %>
|
||||
export OS_PASSWORD=`TERM=linux <%= @keyring_file %> 2>/dev/null`
|
||||
fi
|
||||
@@ -26,7 +26,7 @@ export OS_IDENTITY_API_VERSION=<%= @identity_api_version %>
|
||||
export OS_REGION_NAME=<%= @identity_region %>
|
||||
export OS_INTERFACE=internal
|
||||
|
||||
if [[ "$no_credentials" == false ]]; then
|
||||
if [[ "${no_credentials}" == false ]]; then
|
||||
if [ ! -z "${OS_PASSWORD}" ]; then
|
||||
export PS1='[\u@\h \W(keystone_$OS_USERNAME)]\$ '
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user