From 6dd8a8bee402a6be683075e0669a010a279950ae Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Tue, 22 Jul 2014 01:12:12 +0200 Subject: [PATCH] Users in service group should not have email addresses Change-Id: Ieed9dffce5cf1e735e482dd3494ac1e103b50955 Closes-Bug: 1185201 Signed-off-by: Gael Chamoulaud --- functions-common | 9 +++++++-- lib/ceilometer | 2 +- lib/cinder | 2 +- lib/glance | 2 +- lib/heat | 2 +- lib/ironic | 2 +- lib/keystone | 2 +- lib/marconi | 2 +- lib/neutron | 2 +- lib/nova | 2 +- lib/sahara | 2 +- lib/swift | 2 +- lib/trove | 2 +- 13 files changed, 19 insertions(+), 14 deletions(-) diff --git a/functions-common b/functions-common index 9093952db9..4b660de66d 100644 --- a/functions-common +++ b/functions-common @@ -723,8 +723,13 @@ function policy_add { } # Gets or creates user -# Usage: get_or_create_user +# Usage: get_or_create_user [] function get_or_create_user { + if [[ ! -z "$4" ]]; then + local EMAIL="--email=$4" + else + local EMAIL="" + fi # Gets user id USER_ID=$( # Gets user id @@ -734,7 +739,7 @@ function get_or_create_user { $1 \ --password "$2" \ --project $3 \ - --email $4 \ + $EMAIL \ -f value -c id ) echo $USER_ID diff --git a/lib/ceilometer b/lib/ceilometer index 1540e3eb2c..e7e41988fc 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -85,7 +85,7 @@ create_ceilometer_accounts() { # Ceilometer if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then CEILOMETER_USER=$(get_or_create_user "ceilometer" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "ceilometer@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $CEILOMETER_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/cinder b/lib/cinder index 3965687e98..a51e4a09e7 100644 --- a/lib/cinder +++ b/lib/cinder @@ -323,7 +323,7 @@ function create_cinder_accounts { if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then CINDER_USER=$(get_or_create_user "cinder" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "cinder@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $CINDER_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/glance b/lib/glance index 475bb48b3b..92577d9f47 100644 --- a/lib/glance +++ b/lib/glance @@ -166,7 +166,7 @@ function create_glance_accounts { if is_service_enabled g-api; then GLANCE_USER=$(get_or_create_user "glance" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT_NAME "glance@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT_NAME) get_or_add_user_role service $GLANCE_USER $SERVICE_TENANT_NAME # required for swift access diff --git a/lib/heat b/lib/heat index afed52b62a..510b683ed6 100644 --- a/lib/heat +++ b/lib/heat @@ -217,7 +217,7 @@ function create_heat_accounts { ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") HEAT_USER=$(get_or_create_user "heat" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "heat@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $HEAT_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/ironic b/lib/ironic index ef136bc819..08ac278b60 100644 --- a/lib/ironic +++ b/lib/ironic @@ -221,7 +221,7 @@ function create_ironic_accounts { # Get ironic user if exists IRONIC_USER=$(get_or_create_user "ironic" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "ironic@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $IRONIC_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/keystone b/lib/keystone index 4e94bad9ac..3703008ccc 100644 --- a/lib/keystone +++ b/lib/keystone @@ -330,7 +330,7 @@ function create_keystone_accounts { # admin ADMIN_TENANT=$(get_or_create_project "admin") ADMIN_USER=$(get_or_create_user "admin" \ - "$ADMIN_PASSWORD" "$ADMIN_TENANT" "admin@example.com") + "$ADMIN_PASSWORD" "$ADMIN_TENANT") ADMIN_ROLE=$(get_or_create_role "admin") get_or_add_user_role $ADMIN_ROLE $ADMIN_USER $ADMIN_TENANT diff --git a/lib/marconi b/lib/marconi index d7822c96eb..063ed3d10c 100644 --- a/lib/marconi +++ b/lib/marconi @@ -179,7 +179,7 @@ function create_marconi_accounts { ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") MARCONI_USER=$(get_or_create_user "marconi" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "marconi@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $MARCONI_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/neutron b/lib/neutron index 8b883b1e5a..5ceeb62eb7 100644 --- a/lib/neutron +++ b/lib/neutron @@ -362,7 +362,7 @@ function create_neutron_accounts { if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then NEUTRON_USER=$(get_or_create_user "neutron" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "neutron@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $NEUTRON_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/nova b/lib/nova index ebdb6b40bc..5d879db7fc 100644 --- a/lib/nova +++ b/lib/nova @@ -335,7 +335,7 @@ create_nova_accounts() { if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then NOVA_USER=$(get_or_create_user "nova" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "nova@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $NOVA_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/sahara b/lib/sahara index 0cc2fe96bc..70feacd45a 100644 --- a/lib/sahara +++ b/lib/sahara @@ -61,7 +61,7 @@ function create_sahara_accounts { ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") SAHARA_USER=$(get_or_create_user "sahara" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "sahara@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $SAHARA_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/swift b/lib/swift index 2b161c35c7..84304d34d6 100644 --- a/lib/swift +++ b/lib/swift @@ -550,7 +550,7 @@ function create_swift_accounts { ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") SWIFT_USER=$(get_or_create_user "swift" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "swift@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $ADMIN_ROLE $SWIFT_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then diff --git a/lib/trove b/lib/trove index 2552745209..2a543368e1 100644 --- a/lib/trove +++ b/lib/trove @@ -83,7 +83,7 @@ function create_trove_accounts { if [[ "$ENABLED_SERVICES" =~ "trove" ]]; then TROVE_USER=$(get_or_create_user "trove" \ - "$SERVICE_PASSWORD" $SERVICE_TENANT "trove@example.com") + "$SERVICE_PASSWORD" $SERVICE_TENANT) get_or_add_user_role $SERVICE_ROLE $TROVE_USER $SERVICE_TENANT if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then