| ... | ... |
@@ -695,9 +695,8 @@ function get_or_create_domain {
|
| 695 | 695 |
} |
| 696 | 696 |
|
| 697 | 697 |
# Gets or creates group |
| 698 |
-# Usage: get_or_create_group <groupname> [<domain> <description>] |
|
| 698 |
+# Usage: get_or_create_group <groupname> <domain> [<description>] |
|
| 699 | 699 |
function get_or_create_group {
|
| 700 |
- local domain=${2:+--domain ${2}}
|
|
| 701 | 700 |
local desc="${3:-}"
|
| 702 | 701 |
local os_url="$KEYSTONE_SERVICE_URI_V3" |
| 703 | 702 |
# Gets group id |
| ... | ... |
@@ -705,34 +704,30 @@ function get_or_create_group {
|
| 705 | 705 |
# Creates new group with --or-show |
| 706 | 706 |
openstack --os-token=$OS_TOKEN --os-url=$os_url \ |
| 707 | 707 |
--os-identity-api-version=3 group create $1 \ |
| 708 |
- $domain --description "$desc" --or-show \ |
|
| 708 |
+ --domain $2 --description "$desc" --or-show \ |
|
| 709 | 709 |
-f value -c id |
| 710 | 710 |
) |
| 711 | 711 |
echo $group_id |
| 712 | 712 |
} |
| 713 | 713 |
|
| 714 | 714 |
# Gets or creates user |
| 715 |
-# Usage: get_or_create_user <username> <password> [<email> [<domain>]] |
|
| 715 |
+# Usage: get_or_create_user <username> <password> <domain> [<email>] |
|
| 716 | 716 |
function get_or_create_user {
|
| 717 |
- if [[ ! -z "$3" ]]; then |
|
| 718 |
- local email="--email=$3" |
|
| 717 |
+ if [[ ! -z "$4" ]]; then |
|
| 718 |
+ local email="--email=$4" |
|
| 719 | 719 |
else |
| 720 | 720 |
local email="" |
| 721 | 721 |
fi |
| 722 |
- local os_cmd="openstack" |
|
| 723 |
- local domain="" |
|
| 724 |
- if [[ ! -z "$4" ]]; then |
|
| 725 |
- domain="--domain=$4" |
|
| 726 |
- os_cmd="$os_cmd --os-url=$KEYSTONE_SERVICE_URI_V3 --os-identity-api-version=3" |
|
| 727 |
- fi |
|
| 728 | 722 |
# Gets user id |
| 729 | 723 |
local user_id=$( |
| 730 | 724 |
# Creates new user with --or-show |
| 731 |
- $os_cmd user create \ |
|
| 725 |
+ openstack user create \ |
|
| 732 | 726 |
$1 \ |
| 733 | 727 |
--password "$2" \ |
| 728 |
+ --os-url=$KEYSTONE_SERVICE_URI_V3 \ |
|
| 729 |
+ --os-identity-api-version=3 \ |
|
| 730 |
+ --domain=$3 \ |
|
| 734 | 731 |
$email \ |
| 735 |
- $domain \ |
|
| 736 | 732 |
--or-show \ |
| 737 | 733 |
-f value -c id |
| 738 | 734 |
) |
| ... | ... |
@@ -264,7 +264,7 @@ function create_glance_accounts {
|
| 264 | 264 |
if is_service_enabled s-proxy; then |
| 265 | 265 |
|
| 266 | 266 |
local glance_swift_user=$(get_or_create_user "glance-swift" \ |
| 267 |
- "$SERVICE_PASSWORD" "glance-swift@example.com") |
|
| 267 |
+ "$SERVICE_PASSWORD" "default" "glance-swift@example.com") |
|
| 268 | 268 |
get_or_add_user_project_role "ResellerAdmin" $glance_swift_user $SERVICE_TENANT_NAME |
| 269 | 269 |
fi |
| 270 | 270 |
|
| ... | ... |
@@ -358,7 +358,7 @@ function create_keystone_accounts {
|
| 358 | 358 |
|
| 359 | 359 |
# admin |
| 360 | 360 |
local admin_tenant=$(get_or_create_project "admin" default) |
| 361 |
- local admin_user=$(get_or_create_user "admin" "$ADMIN_PASSWORD") |
|
| 361 |
+ local admin_user=$(get_or_create_user "admin" "$ADMIN_PASSWORD" default) |
|
| 362 | 362 |
local admin_role=$(get_or_create_role "admin") |
| 363 | 363 |
get_or_add_user_project_role $admin_role $admin_user $admin_tenant |
| 364 | 364 |
|
| ... | ... |
@@ -387,7 +387,7 @@ function create_keystone_accounts {
|
| 387 | 387 |
# demo |
| 388 | 388 |
local demo_tenant=$(get_or_create_project "demo" default) |
| 389 | 389 |
local demo_user=$(get_or_create_user "demo" \ |
| 390 |
- "$ADMIN_PASSWORD" "demo@example.com") |
|
| 390 |
+ "$ADMIN_PASSWORD" "default" "demo@example.com") |
|
| 391 | 391 |
|
| 392 | 392 |
get_or_add_user_project_role $member_role $demo_user $demo_tenant |
| 393 | 393 |
get_or_add_user_project_role $admin_role $admin_user $demo_tenant |
| ... | ... |
@@ -426,7 +426,7 @@ function create_keystone_accounts {
|
| 426 | 426 |
function create_service_user {
|
| 427 | 427 |
local role=${2:-service}
|
| 428 | 428 |
|
| 429 |
- local user=$(get_or_create_user "$1" "$SERVICE_PASSWORD") |
|
| 429 |
+ local user=$(get_or_create_user "$1" "$SERVICE_PASSWORD" default) |
|
| 430 | 430 |
get_or_add_user_project_role "$role" "$user" "$SERVICE_TENANT_NAME" |
| 431 | 431 |
} |
| 432 | 432 |
|
| ... | ... |
@@ -618,18 +618,21 @@ function create_swift_accounts {
|
| 618 | 618 |
|
| 619 | 619 |
local swift_tenant_test1=$(get_or_create_project swifttenanttest1 default) |
| 620 | 620 |
die_if_not_set $LINENO swift_tenant_test1 "Failure creating swift_tenant_test1" |
| 621 |
- SWIFT_USER_TEST1=$(get_or_create_user swiftusertest1 $swiftusertest1_password "test@example.com") |
|
| 621 |
+ SWIFT_USER_TEST1=$(get_or_create_user swiftusertest1 $swiftusertest1_password \ |
|
| 622 |
+ "default" "test@example.com") |
|
| 622 | 623 |
die_if_not_set $LINENO SWIFT_USER_TEST1 "Failure creating SWIFT_USER_TEST1" |
| 623 | 624 |
get_or_add_user_project_role admin $SWIFT_USER_TEST1 $swift_tenant_test1 |
| 624 | 625 |
|
| 625 |
- local swift_user_test3=$(get_or_create_user swiftusertest3 $swiftusertest3_password "test3@example.com") |
|
| 626 |
+ local swift_user_test3=$(get_or_create_user swiftusertest3 $swiftusertest3_password \ |
|
| 627 |
+ "default" "test3@example.com") |
|
| 626 | 628 |
die_if_not_set $LINENO swift_user_test3 "Failure creating swift_user_test3" |
| 627 | 629 |
get_or_add_user_project_role $another_role $swift_user_test3 $swift_tenant_test1 |
| 628 | 630 |
|
| 629 | 631 |
local swift_tenant_test2=$(get_or_create_project swifttenanttest2 default) |
| 630 | 632 |
die_if_not_set $LINENO swift_tenant_test2 "Failure creating swift_tenant_test2" |
| 631 | 633 |
|
| 632 |
- local swift_user_test2=$(get_or_create_user swiftusertest2 $swiftusertest2_password "test2@example.com") |
|
| 634 |
+ local swift_user_test2=$(get_or_create_user swiftusertest2 $swiftusertest2_password \ |
|
| 635 |
+ "default" "test2@example.com") |
|
| 633 | 636 |
die_if_not_set $LINENO swift_user_test2 "Failure creating swift_user_test2" |
| 634 | 637 |
get_or_add_user_project_role admin $swift_user_test2 $swift_tenant_test2 |
| 635 | 638 |
|
| ... | ... |
@@ -639,7 +642,8 @@ function create_swift_accounts {
|
| 639 | 639 |
local swift_tenant_test4=$(get_or_create_project swifttenanttest4 $swift_domain) |
| 640 | 640 |
die_if_not_set $LINENO swift_tenant_test4 "Failure creating swift_tenant_test4" |
| 641 | 641 |
|
| 642 |
- local swift_user_test4=$(get_or_create_user swiftusertest4 $swiftusertest4_password "test4@example.com" $swift_domain) |
|
| 642 |
+ local swift_user_test4=$(get_or_create_user swiftusertest4 $swiftusertest4_password \ |
|
| 643 |
+ $swift_domain "test4@example.com") |
|
| 643 | 644 |
die_if_not_set $LINENO swift_user_test4 "Failure creating swift_user_test4" |
| 644 | 645 |
get_or_add_user_project_role admin $swift_user_test4 $swift_tenant_test4 |
| 645 | 646 |
} |
| ... | ... |
@@ -551,7 +551,7 @@ function create_tempest_accounts {
|
| 551 | 551 |
# Tempest has some tests that validate various authorization checks |
| 552 | 552 |
# between two regular users in separate tenants |
| 553 | 553 |
get_or_create_project alt_demo default |
| 554 |
- get_or_create_user alt_demo "$ADMIN_PASSWORD" "alt_demo@example.com" |
|
| 554 |
+ get_or_create_user alt_demo "$ADMIN_PASSWORD" "default" "alt_demo@example.com" |
|
| 555 | 555 |
get_or_add_user_project_role Member alt_demo alt_demo |
| 556 | 556 |
fi |
| 557 | 557 |
} |
| ... | ... |
@@ -1012,6 +1012,9 @@ if is_service_enabled keystone; then |
| 1012 | 1012 |
# Begone token auth |
| 1013 | 1013 |
unset OS_TOKEN OS_URL |
| 1014 | 1014 |
|
| 1015 |
+ # force set to use v2 identity authentication even with v3 commands |
|
| 1016 |
+ export OS_AUTH_TYPE=v2password |
|
| 1017 |
+ |
|
| 1015 | 1018 |
# Set up password auth credentials now that Keystone is bootstrapped |
| 1016 | 1019 |
export OS_AUTH_URL=$SERVICE_ENDPOINT |
| 1017 | 1020 |
export OS_TENANT_NAME=admin |