Isolate creating service users
The code for creating service users is almost exactly the same. Abstract
this into a function that can be reused and standardized.
Change-Id: I3a4edbff0a928da7ef9b0097a5a8d508fdfab7ff
diff --git a/lib/sahara b/lib/sahara
index 44c06d3..cb6ecc3 100644
--- a/lib/sahara
+++ b/lib/sahara
@@ -61,11 +61,7 @@
# service sahara admin
function create_sahara_accounts {
- local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
- local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
-
- local sahara_user=$(get_or_create_user "sahara" "$SERVICE_PASSWORD")
- get_or_add_user_role $admin_role $sahara_user $service_tenant
+ create_service_user "sahara" "admin"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then