Browse code

Users in service group should not have email addresses

Change-Id: Ieed9dffce5cf1e735e482dd3494ac1e103b50955
Closes-Bug: 1185201
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>

Gael Chamoulaud authored on 2014/07/22 08:12:12
Showing 13 changed files
... ...
@@ -723,8 +723,13 @@ function policy_add {
723 723
 }
724 724
 
725 725
 # Gets or creates user
726
-# Usage: get_or_create_user <username> <password> <project> <email>
726
+# Usage: get_or_create_user <username> <password> <project> [<email>]
727 727
 function get_or_create_user {
728
+    if [[ ! -z "$4" ]]; then
729
+        local EMAIL="--email=$4"
730
+    else
731
+        local EMAIL=""
732
+    fi
728 733
     # Gets user id
729 734
     USER_ID=$(
730 735
         # Gets user id
... ...
@@ -734,7 +739,7 @@ function get_or_create_user {
734 734
             $1 \
735 735
             --password "$2" \
736 736
             --project $3 \
737
-            --email $4 \
737
+            $EMAIL \
738 738
             -f value -c id
739 739
     )
740 740
     echo $USER_ID
... ...
@@ -85,7 +85,7 @@ create_ceilometer_accounts() {
85 85
     # Ceilometer
86 86
     if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then
87 87
         CEILOMETER_USER=$(get_or_create_user "ceilometer" \
88
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "ceilometer@example.com")
88
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
89 89
         get_or_add_user_role $ADMIN_ROLE $CEILOMETER_USER $SERVICE_TENANT
90 90
 
91 91
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -323,7 +323,7 @@ function create_cinder_accounts {
323 323
     if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
324 324
 
325 325
         CINDER_USER=$(get_or_create_user "cinder" \
326
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "cinder@example.com")
326
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
327 327
         get_or_add_user_role $ADMIN_ROLE $CINDER_USER $SERVICE_TENANT
328 328
 
329 329
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -166,7 +166,7 @@ function create_glance_accounts {
166 166
     if is_service_enabled g-api; then
167 167
 
168 168
         GLANCE_USER=$(get_or_create_user "glance" \
169
-            "$SERVICE_PASSWORD" $SERVICE_TENANT_NAME "glance@example.com")
169
+            "$SERVICE_PASSWORD" $SERVICE_TENANT_NAME)
170 170
         get_or_add_user_role service $GLANCE_USER $SERVICE_TENANT_NAME
171 171
 
172 172
         # required for swift access
... ...
@@ -217,7 +217,7 @@ function create_heat_accounts {
217 217
     ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
218 218
 
219 219
     HEAT_USER=$(get_or_create_user "heat" \
220
-        "$SERVICE_PASSWORD" $SERVICE_TENANT "heat@example.com")
220
+        "$SERVICE_PASSWORD" $SERVICE_TENANT)
221 221
     get_or_add_user_role $ADMIN_ROLE $HEAT_USER $SERVICE_TENANT
222 222
 
223 223
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -221,7 +221,7 @@ function create_ironic_accounts {
221 221
         # Get ironic user if exists
222 222
 
223 223
         IRONIC_USER=$(get_or_create_user "ironic" \
224
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "ironic@example.com")
224
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
225 225
         get_or_add_user_role $ADMIN_ROLE $IRONIC_USER $SERVICE_TENANT
226 226
 
227 227
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -330,7 +330,7 @@ function create_keystone_accounts {
330 330
     # admin
331 331
     ADMIN_TENANT=$(get_or_create_project "admin")
332 332
     ADMIN_USER=$(get_or_create_user "admin" \
333
-        "$ADMIN_PASSWORD" "$ADMIN_TENANT" "admin@example.com")
333
+        "$ADMIN_PASSWORD" "$ADMIN_TENANT")
334 334
     ADMIN_ROLE=$(get_or_create_role "admin")
335 335
     get_or_add_user_role $ADMIN_ROLE $ADMIN_USER $ADMIN_TENANT
336 336
 
... ...
@@ -179,7 +179,7 @@ function create_marconi_accounts {
179 179
     ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
180 180
 
181 181
     MARCONI_USER=$(get_or_create_user "marconi" \
182
-        "$SERVICE_PASSWORD" $SERVICE_TENANT "marconi@example.com")
182
+        "$SERVICE_PASSWORD" $SERVICE_TENANT)
183 183
     get_or_add_user_role $ADMIN_ROLE $MARCONI_USER $SERVICE_TENANT
184 184
 
185 185
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -362,7 +362,7 @@ function create_neutron_accounts {
362 362
     if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
363 363
 
364 364
         NEUTRON_USER=$(get_or_create_user "neutron" \
365
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "neutron@example.com")
365
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
366 366
         get_or_add_user_role $ADMIN_ROLE $NEUTRON_USER $SERVICE_TENANT
367 367
 
368 368
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -335,7 +335,7 @@ create_nova_accounts() {
335 335
     if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
336 336
 
337 337
         NOVA_USER=$(get_or_create_user "nova" \
338
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "nova@example.com")
338
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
339 339
         get_or_add_user_role $ADMIN_ROLE $NOVA_USER $SERVICE_TENANT
340 340
 
341 341
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -61,7 +61,7 @@ function create_sahara_accounts {
61 61
     ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
62 62
 
63 63
     SAHARA_USER=$(get_or_create_user "sahara" \
64
-        "$SERVICE_PASSWORD" $SERVICE_TENANT "sahara@example.com")
64
+        "$SERVICE_PASSWORD" $SERVICE_TENANT)
65 65
     get_or_add_user_role $ADMIN_ROLE $SAHARA_USER $SERVICE_TENANT
66 66
 
67 67
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -550,7 +550,7 @@ function create_swift_accounts {
550 550
     ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
551 551
 
552 552
     SWIFT_USER=$(get_or_create_user "swift" \
553
-        "$SERVICE_PASSWORD" $SERVICE_TENANT "swift@example.com")
553
+        "$SERVICE_PASSWORD" $SERVICE_TENANT)
554 554
     get_or_add_user_role $ADMIN_ROLE $SWIFT_USER $SERVICE_TENANT
555 555
 
556 556
     if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
... ...
@@ -83,7 +83,7 @@ function create_trove_accounts {
83 83
     if [[ "$ENABLED_SERVICES" =~ "trove" ]]; then
84 84
 
85 85
         TROVE_USER=$(get_or_create_user "trove" \
86
-            "$SERVICE_PASSWORD" $SERVICE_TENANT "trove@example.com")
86
+            "$SERVICE_PASSWORD" $SERVICE_TENANT)
87 87
         get_or_add_user_role $SERVICE_ROLE $TROVE_USER $SERVICE_TENANT
88 88
 
89 89
         if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then