summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-keystone
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2013-08-15 00:28:05 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2013-08-28 18:41:59 -0400
commit0026bb7f51989b3337ff84ffddcdb90cba944eb9 (patch)
treeec542ba22aa0489d33c23e7fa6855b9497344ab4 /meta-openstack/recipes-devtools/python/python-keystone
parent1b62d4b061a69a83de795bba76064d5bf7bfd379 (diff)
downloadmeta-cloud-services-0026bb7f51989b3337ff84ffddcdb90cba944eb9.tar.gz
keystone: make identity.sh re-entrant
Sometimes it is desirable to double check the identities, roles and ids in the system. To re-intialize the database, we can allow identity.sh to be re run. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystone')
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone/identity.sh90
1 files changed, 78 insertions, 12 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/identity.sh b/meta-openstack/recipes-devtools/python/python-keystone/identity.sh
index 78d5099..db222e1 100644
--- a/meta-openstack/recipes-devtools/python/python-keystone/identity.sh
+++ b/meta-openstack/recipes-devtools/python/python-keystone/identity.sh
@@ -29,28 +29,94 @@ function get_field() {
29} 29}
30 30
31# Tenants 31# Tenants
32ADMIN_TENANT=$(keystone tenant-create --name=admin | grep " id " | get_field 2) 32keystone tenant-get admin
33DEMO_TENANT=$(keystone tenant-create --name=demo | grep " id " | get_field 2) 33if [ $? -eq 1 ]; then
34SERVICE_TENANT=$(keystone tenant-create --name=$SERVICE_TENANT_NAME | grep " id " | get_field 2) 34 ADMIN_TENANT=$(keystone tenant-create --name=admin | grep " id " | get_field 2)
35else
36 ADMIN_TENANT=$(keystone tenant-get admin | grep " id " | get_field 2)
37fi
38keystone tenant-get demo
39if [ $? -eq 1 ]; then
40 DEMO_TENANT=$(keystone tenant-create --name=demo | grep " id " | get_field 2)
41else
42 DEMO_TENANT=$(keystone tenant-get demo | grep " id " | get_field 2)
43fi
44keystone tenant-get $SERVICE_TENANT_NAME
45if [ $? -eq 1 ]; then
46 SERVICE_TENANT=$(keystone tenant-create --name=$SERVICE_TENANT_NAME | grep " id " | get_field 2)
47else
48 SERVICE_TENANT=$(keystone tenant-get $SERVICE_TENANT_NAME | grep " id " | get_field 2)
49fi
35 50
36# Users 51# Users
37ADMIN_USER=$(keystone user-create --name=admin --pass="$ADMIN_PASSWORD" --email=admin@domain.com | grep " id " | get_field 2) 52keystone user-get admin
38DEMO_USER=$(keystone user-create --name=demo --pass="$DEMO_PASSWORD" --email=demo@domain.com --tenant-id=$DEMO_TENANT | grep " id " | get_field 2) 53if [ $? -eq 1 ]; then
39NOVA_USER=$(keystone user-create --name=nova --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=nova@domain.com | grep " id " | get_field 2) 54 ADMIN_USER=$(keystone user-create --name=admin --pass="$ADMIN_PASSWORD" --email=admin@domain.com | grep " id " | get_field 2)
40GLANCE_USER=$(keystone user-create --name=glance --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=glance@domain.com | grep " id " | get_field 2) 55else
41QUANTUM_USER=$(keystone user-create --name=quantum --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=quantum@domain.com | grep " id " | get_field 2) 56 ADMIN_USER=$(keystone user-get admin | grep " id " | get_field 2)
42CINDER_USER=$(keystone user-create --name=cinder --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=cinder@domain.com | grep " id " | get_field 2) 57fi
58keystone user-get demo
59if [ $? -eq 1 ]; then
60 DEMO_USER=$(keystone user-create --name=demo --pass="$DEMO_PASSWORD" --email=demo@domain.com --tenant-id=$DEMO_TENANT | grep " id " | get_field 2)
61else
62 DEMO_USER=$(keystone user-get demo | grep " id " | get_field 2)
63fi
64keystone user-get nova
65if [ $? -eq 1 ]; then
66 NOVA_USER=$(keystone user-create --name=nova --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=nova@domain.com | grep " id " | get_field 2)
67else
68 NOVA_USER=$(keystone user-get nova | grep " id " | get_field 2)
69fi
70keystone user-get glance
71if [ $? -eq 1 ]; then
72 GLANCE_USER=$(keystone user-create --name=glance --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=glance@domain.com | grep " id " | get_field 2)
73else
74 GLANCE_USER=$(keystone user-get glance | grep " id " | get_field 2)
75fi
76keystone user-get quantum
77if [ $? -eq 1 ]; then
78 QUANTUM_USER=$(keystone user-create --name=quantum --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=quantum@domain.com | grep " id " | get_field 2)
79else
80 QUANTUM_USER=$(keystone user-get quantum | grep " id " | get_field 2)
81fi
82keystone user-get cinder
83if [ $? -eq 1 ]; then
84 CINDER_USER=$(keystone user-create --name=cinder --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=cinder@domain.com | grep " id " | get_field 2)
85else
86 CINDER_USER=$(keystone user-get cinder | grep " id " | get_field 2)
87fi
43 88
44# Roles 89# Roles
45ADMIN_ROLE=$(keystone role-create --name=admin | grep " id " | get_field 2) 90keystone role-get admin
46MEMBER_ROLE=$(keystone role-create --name=Member | grep " id " | get_field 2) 91if [ $? -eq 1 ]; then
92 ADMIN_ROLE=$(keystone role-create --name=admin | grep " id " | get_field 2)
93else
94 ADMIN_ROLE=$(keystone role-get admin | grep " id " | get_field 2)
95fi
96keystone role-get Member
97if [ $? -eq 1 ]; then
98 MEMBER_ROLE=$(keystone role-create --name=Member | grep " id " | get_field 2)
99else
100 MEMBER_ROLE=$(keystone role-get Member | grep " id " | get_field 2)
101fi
47 102
48# Add Roles to Users in Tenants 103# Add Roles to Users in Tenants
49keystone user-role-add --user-id $ADMIN_USER --role-id $ADMIN_ROLE --tenant-id $ADMIN_TENANT 104keystone user-role-list --user-id $ADMIN_USER --tenant-id $ADMIN_TENANT &> /dev/null
105keystone user-role-add --tenant-id $ADMIN_TENANT --user-id $ADMIN_USER --role-id $ADMIN_ROLE
106
107keystone user-role-list --user-id $NOVA_USER --tenant-id $SERVICE_TENANT &> /dev/null
50keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $ADMIN_ROLE 108keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $ADMIN_ROLE
109
110keystone user-role-list --user-id $GLANCE_USER --tenant-id $SERVICE_TENANT &> /dev/null
51keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $GLANCE_USER --role-id $ADMIN_ROLE 111keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $GLANCE_USER --role-id $ADMIN_ROLE
112
113keystone user-role-list --user-id $QUANTUM_USER --tenant-id $SERVICE_TENANT &> /dev/null
52keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $QUANTUM_USER --role-id $ADMIN_ROLE 114keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $QUANTUM_USER --role-id $ADMIN_ROLE
115
116keystone user-role-list --user-id $CINDER_USER --tenant-id $SERVICE_TENANT &> /dev/null
53keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $CINDER_USER --role-id $ADMIN_ROLE 117keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $CINDER_USER --role-id $ADMIN_ROLE
118
119keystone user-role-list --user-id $DEMO_USER --tenant-id $DEMO_TENANT &> /dev/null
54keystone user-role-add --tenant-id $DEMO_TENANT --user-id $DEMO_USER --role-id $MEMBER_ROLE 120keystone user-role-add --tenant-id $DEMO_TENANT --user-id $DEMO_USER --role-id $MEMBER_ROLE
55 121
56# Create services 122# Create services