Merge "local call masks errors in subshells"

This commit is contained in:
Jenkins 2015-07-22 23:36:02 +00:00 committed by Gerrit Code Review
commit 9cdde34319

View File

@ -686,9 +686,10 @@ function policy_add {
# Gets or creates a domain # Gets or creates a domain
# Usage: get_or_create_domain <name> <description> # Usage: get_or_create_domain <name> <description>
function get_or_create_domain { function get_or_create_domain {
local domain_id
local os_url="$KEYSTONE_SERVICE_URI_V3" local os_url="$KEYSTONE_SERVICE_URI_V3"
# Gets domain id # Gets domain id
local domain_id=$( domain_id=$(
# Gets domain id # Gets domain id
openstack --os-token=$OS_TOKEN --os-url=$os_url \ openstack --os-token=$OS_TOKEN --os-url=$os_url \
--os-identity-api-version=3 domain show $1 \ --os-identity-api-version=3 domain show $1 \
@ -707,8 +708,9 @@ function get_or_create_domain {
function get_or_create_group { function get_or_create_group {
local desc="${3:-}" local desc="${3:-}"
local os_url="$KEYSTONE_SERVICE_URI_V3" local os_url="$KEYSTONE_SERVICE_URI_V3"
local group_id
# Gets group id # Gets group id
local group_id=$( group_id=$(
# Creates new group with --or-show # Creates new group with --or-show
openstack --os-token=$OS_TOKEN --os-url=$os_url \ openstack --os-token=$OS_TOKEN --os-url=$os_url \
--os-identity-api-version=3 group create $1 \ --os-identity-api-version=3 group create $1 \
@ -721,13 +723,14 @@ function get_or_create_group {
# Gets or creates user # Gets or creates user
# Usage: get_or_create_user <username> <password> <domain> [<email>] # Usage: get_or_create_user <username> <password> <domain> [<email>]
function get_or_create_user { function get_or_create_user {
local user_id
if [[ ! -z "$4" ]]; then if [[ ! -z "$4" ]]; then
local email="--email=$4" local email="--email=$4"
else else
local email="" local email=""
fi fi
# Gets user id # Gets user id
local user_id=$( user_id=$(
# Creates new user with --or-show # Creates new user with --or-show
openstack user create \ openstack user create \
$1 \ $1 \
@ -745,7 +748,8 @@ function get_or_create_user {
# Gets or creates project # Gets or creates project
# Usage: get_or_create_project <name> <domain> # Usage: get_or_create_project <name> <domain>
function get_or_create_project { function get_or_create_project {
local project_id=$( local project_id
project_id=$(
# Creates new project with --or-show # Creates new project with --or-show
openstack --os-url=$KEYSTONE_SERVICE_URI_V3 \ openstack --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 \ --os-identity-api-version=3 \
@ -759,7 +763,8 @@ function get_or_create_project {
# Gets or creates role # Gets or creates role
# Usage: get_or_create_role <name> # Usage: get_or_create_role <name>
function get_or_create_role { function get_or_create_role {
local role_id=$( local role_id
role_id=$(
# Creates role with --or-show # Creates role with --or-show
openstack role create $1 \ openstack role create $1 \
--os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \
@ -772,8 +777,9 @@ function get_or_create_role {
# Gets or adds user role to project # Gets or adds user role to project
# Usage: get_or_add_user_project_role <role> <user> <project> # Usage: get_or_add_user_project_role <role> <user> <project>
function get_or_add_user_project_role { function get_or_add_user_project_role {
local user_role_id
# Gets user role id # Gets user role id
local user_role_id=$(openstack role list \ user_role_id=$(openstack role list \
--user $2 \ --user $2 \
--os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 \ --os-identity-api-version=3 \
@ -797,8 +803,9 @@ function get_or_add_user_project_role {
# Gets or adds group role to project # Gets or adds group role to project
# Usage: get_or_add_group_project_role <role> <group> <project> # Usage: get_or_add_group_project_role <role> <group> <project>
function get_or_add_group_project_role { function get_or_add_group_project_role {
local group_role_id
# Gets group role id # Gets group role id
local group_role_id=$(openstack role list \ group_role_id=$(openstack role list \
--os-url=$KEYSTONE_SERVICE_URI_V3 \ --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 \ --os-identity-api-version=3 \
--group $2 \ --group $2 \
@ -824,8 +831,9 @@ function get_or_add_group_project_role {
# Gets or creates service # Gets or creates service
# Usage: get_or_create_service <name> <type> <description> # Usage: get_or_create_service <name> <type> <description>
function get_or_create_service { function get_or_create_service {
local service_id
# Gets service id # Gets service id
local service_id=$( service_id=$(
# Gets service id # Gets service id
openstack service show $2 -f value -c id 2>/dev/null || openstack service show $2 -f value -c id 2>/dev/null ||
# Creates new service if not exists # Creates new service if not exists
@ -843,7 +851,8 @@ function get_or_create_service {
# Create an endpoint with a specific interface # Create an endpoint with a specific interface
# Usage: _get_or_create_endpoint_with_interface <service> <interface> <url> <region> # Usage: _get_or_create_endpoint_with_interface <service> <interface> <url> <region>
function _get_or_create_endpoint_with_interface { function _get_or_create_endpoint_with_interface {
local endpoint_id=$(openstack endpoint list \ local endpoint_id
endpoint_id=$(openstack endpoint list \
--os-url $KEYSTONE_SERVICE_URI_V3 \ --os-url $KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 \ --os-identity-api-version=3 \
--service $1 \ --service $1 \