Merge "Fix return value of get_or_add_user_project_role"
diff --git a/functions-common b/functions-common
index d5ef66a..1c3fcd5 100644
--- a/functions-common
+++ b/functions-common
@@ -830,14 +830,20 @@
--column "Name" \
| grep " $1 " | get_field 1)
if [[ -z "$user_role_id" ]]; then
- # Adds role to user
- user_role_id=$(openstack role add \
- $1 \
+ # Adds role to user and get it
+ openstack role add $1 \
--user $2 \
--project $3 \
--os-url=$KEYSTONE_SERVICE_URI_V3 \
+ --os-identity-api-version=3
+ user_role_id=$(openstack role list \
+ --user $2 \
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \
--os-identity-api-version=3 \
- | grep " id " | get_field 2)
+ --column "ID" \
+ --project $3 \
+ --column "Name" \
+ | grep " $1 " | get_field 1)
fi
echo $user_role_id
}