Use extended keystone-manage bootstrap parameters

Use the additional keystone-manage parameters to setup the identity
endpoint in the service catalog rather than manually fetching a token
for this.

Change-Id: I6f5be1df205dee8f3251b4eb413e00ae64f00f07
diff --git a/lib/keystone b/lib/keystone
index 5ed7de9..0b9cebc 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -629,40 +629,16 @@
 # - ``KEYSTONE_SERVICE_HOST``
 # - ``KEYSTONE_SERVICE_PORT``
 function bootstrap_keystone {
-
-    # Initialize keystone, this will create an 'admin' user, 'admin' project,
-    # 'admin' role, and assign the user the role on the project. These resources
-    # are created only if they do not already exist.
-    $KEYSTONE_BIN_DIR/keystone-manage bootstrap --bootstrap-password $ADMIN_PASSWORD
-
-    # Create the keystone service and endpoints. To do this with the new
-    # bootstrapping process, we need to get a token and use that token to
-    # interact with the new APIs. The token will only be used to create services
-    # and endpoints, thus creating a minimal service catalog.
-    # They are unset immediately after.
-    # TODO(stevemar): OpenStackClient and KeystoneClient do not have support to
-    # handle interactions that not return service catalogs. Eventually remove
-    # this section when the support is in place. Use token based auth for now.
-    local token_id
-    token_id=$(openstack token issue -c id -f value \
-        --os-username admin --os-project-name admin \
-        --os-user-domain-id default --os-project-domain-id default \
-        --os-identity-api-version 3 --os-auth-url $KEYSTONE_AUTH_URI \
-        --os-password $ADMIN_PASSWORD)
-
-    export OS_TOKEN=$token_id
-    export OS_URL=$KEYSTONE_AUTH_URI/v3
-    export OS_IDENTITY_API_VERSION=3
-
-    get_or_create_service "keystone" "identity" "Keystone Identity Service"
-    get_or_create_endpoint \
-        "identity" \
-        "$REGION_NAME" \
-        "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION" \
-        "$KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION" \
-        "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION"
-
-    unset OS_TOKEN OS_URL OS_IDENTITY_API_VERSION
+    $KEYSTONE_BIN_DIR/keystone-manage bootstrap \
+        --bootstrap-username admin \
+        --bootstrap-password "$ADMIN_PASSWORD" \
+        --bootstrap-project-name admin \
+        --bootstrap-role-name admin \
+        --bootstrap-service-name keystone \
+        --bootstrap-region-id "$REGION_NAME" \
+        --bootstrap-admin-url "$KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION" \
+        --bootstrap-public-url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION" \
+        --bootstrap-internal-url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/v$IDENTITY_API_VERSION"
 }
 
 # Restore xtrace