]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add script to add heat service catalog into keystone
authorAngus Salkeld <asalkeld@redhat.com>
Fri, 30 Mar 2012 02:51:24 +0000 (13:51 +1100)
committerAngus Salkeld <asalkeld@redhat.com>
Fri, 30 Mar 2012 02:51:24 +0000 (13:51 +1100)
Note the user add is not working for me. But could
be because I have partly done this a couple of times.

This is based off of:
https://github.com/openstack/keystone/blob/master/tools/sample_data.sh

Related to issue #31

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
tools/heat-keystone-service [new file with mode: 0755]

diff --git a/tools/heat-keystone-service b/tools/heat-keystone-service
new file mode 100755 (executable)
index 0000000..56b9f7d
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+set +e
+
+function get_id () {
+    echo `"$@" | grep ' id ' | awk '{print $4}'`
+}
+
+ADMIN_ROLE=$(keystone user-list | grep True | cut -d\| -f2,5 | grep admin | cut -d\| -f1)
+SERVICE_TENANT=$(keystone tenant-list | grep service | cut -d\| -f2)
+SERVICE_PASSWORD=${SERVICE_PASSWORD:-$OS_PASSWORD}
+if [[ "$SERVICE_PASSWORD" == "$OS_PASSWORD" ]]; then
+    echo "Using the OS_PASSWORD for the SERVICE_PASSWORD."
+    echo "I hope this works"
+fi
+
+echo ADMIN_ROLE $ADMIN_ROLE
+echo SERVICE_TENANT $SERVICE_TENANT
+echo SERVICE_PASSWORD $SERVICE_PASSWORD
+
+
+# Services
+HEAT_SERVICE=$(get_id \
+keystone service-create --name=heat \
+                        --type=heat \
+                        --description="Heat Service")
+HEAT_USER=$(get_id keystone user-create --name=heat \
+                                        --pass="$SERVICE_PASSWORD" \
+                                        --tenant_id $SERVICE_TENANT \
+                                        --email=heat@example.com)
+echo HEAT_USER $HEAT_USER
+keystone user-role-add --tenant_id $SERVICE_TENANT \
+                       --user $HEAT_USER \
+                       --role $ADMIN_ROLE
+
+keystone endpoint-create --region RegionOne --service_id $HEAT_SERVICE \
+    --publicurl 'http://localhost:8000/v1' \
+    --adminurl 'http://localhost:8000/v1' \
+    --internalurl 'http://localhost:8000/v1'
+