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/zaqar b/lib/zaqar
index 618ac30..8b560bb 100644
--- a/lib/zaqar
+++ b/lib/zaqar
@@ -215,11 +215,7 @@
}
function create_zaqar_accounts {
- local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
- ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
-
- local zaqar_user=$(get_or_create_user "zaqar" "$SERVICE_PASSWORD")
- get_or_add_user_role $ADMIN_ROLE $zaqar_user $service_tenant
+ create_service_user "zaqar" "admin"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then