| ... | ... |
@@ -759,7 +759,10 @@ function get_or_create_project {
|
| 759 | 759 |
function get_or_create_role {
|
| 760 | 760 |
local role_id=$( |
| 761 | 761 |
# Creates role with --or-show |
| 762 |
- openstack role create $1 --or-show -f value -c id |
|
| 762 |
+ openstack role create $1 \ |
|
| 763 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 764 |
+ --os-identity-api-version=3 \ |
|
| 765 |
+ --or-show -f value -c id |
|
| 763 | 766 |
) |
| 764 | 767 |
echo $role_id |
| 765 | 768 |
} |
| ... | ... |
@@ -770,8 +773,10 @@ function get_or_add_user_project_role {
|
| 770 | 770 |
# Gets user role id |
| 771 | 771 |
local user_role_id=$(openstack role list \ |
| 772 | 772 |
--user $2 \ |
| 773 |
- --project $3 \ |
|
| 773 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 774 |
+ --os-identity-api-version=3 \ |
|
| 774 | 775 |
--column "ID" \ |
| 776 |
+ --project $3 \ |
|
| 775 | 777 |
--column "Name" \ |
| 776 | 778 |
| grep " $1 " | get_field 1) |
| 777 | 779 |
if [[ -z "$user_role_id" ]]; then |
| ... | ... |
@@ -780,6 +785,8 @@ function get_or_add_user_project_role {
|
| 780 | 780 |
$1 \ |
| 781 | 781 |
--user $2 \ |
| 782 | 782 |
--project $3 \ |
| 783 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 784 |
+ --os-identity-api-version=3 \ |
|
| 783 | 785 |
| grep " id " | get_field 2) |
| 784 | 786 |
fi |
| 785 | 787 |
echo $user_role_id |
| ... | ... |
@@ -790,18 +797,24 @@ function get_or_add_user_project_role {
|
| 790 | 790 |
function get_or_add_group_project_role {
|
| 791 | 791 |
# Gets group role id |
| 792 | 792 |
local group_role_id=$(openstack role list \ |
| 793 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 794 |
+ --os-identity-api-version=3 \ |
|
| 793 | 795 |
--group $2 \ |
| 794 | 796 |
--project $3 \ |
| 795 |
- --column "ID" \ |
|
| 796 |
- --column "Name" \ |
|
| 797 |
- | grep " $1 " | get_field 1) |
|
| 797 |
+ -c "ID" -f value) |
|
| 798 | 798 |
if [[ -z "$group_role_id" ]]; then |
| 799 |
- # Adds role to group |
|
| 800 |
- group_role_id=$(openstack role add \ |
|
| 801 |
- $1 \ |
|
| 799 |
+ # Adds role to group and get it |
|
| 800 |
+ openstack role add $1 \ |
|
| 801 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 802 |
+ --os-identity-api-version=3 \ |
|
| 803 |
+ --group $2 \ |
|
| 804 |
+ --project $3 |
|
| 805 |
+ group_role_id=$(openstack role list \ |
|
| 806 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 807 |
+ --os-identity-api-version=3 \ |
|
| 802 | 808 |
--group $2 \ |
| 803 | 809 |
--project $3 \ |
| 804 |
- | grep " id " | get_field 2) |
|
| 810 |
+ -c "ID" -f value) |
|
| 805 | 811 |
fi |
| 806 | 812 |
echo $group_role_id |
| 807 | 813 |
} |