| ... | ... |
@@ -830,14 +830,20 @@ function get_or_add_user_project_role {
|
| 830 | 830 |
--column "Name" \ |
| 831 | 831 |
| grep " $1 " | get_field 1) |
| 832 | 832 |
if [[ -z "$user_role_id" ]]; then |
| 833 |
- # Adds role to user |
|
| 834 |
- user_role_id=$(openstack role add \ |
|
| 835 |
- $1 \ |
|
| 833 |
+ # Adds role to user and get it |
|
| 834 |
+ openstack role add $1 \ |
|
| 836 | 835 |
--user $2 \ |
| 837 | 836 |
--project $3 \ |
| 838 | 837 |
--os-url=$KEYSTONE_SERVICE_URI_V3 \ |
| 838 |
+ --os-identity-api-version=3 |
|
| 839 |
+ user_role_id=$(openstack role list \ |
|
| 840 |
+ --user $2 \ |
|
| 841 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 839 | 842 |
--os-identity-api-version=3 \ |
| 840 |
- | grep " id " | get_field 2) |
|
| 843 |
+ --column "ID" \ |
|
| 844 |
+ --project $3 \ |
|
| 845 |
+ --column "Name" \ |
|
| 846 |
+ | grep " $1 " | get_field 1) |
|
| 841 | 847 |
fi |
| 842 | 848 |
echo $user_role_id |
| 843 | 849 |
} |