diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-08-15 00:28:05 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-08-28 18:41:59 -0400 |
commit | 0026bb7f51989b3337ff84ffddcdb90cba944eb9 (patch) | |
tree | ec542ba22aa0489d33c23e7fa6855b9497344ab4 /meta-openstack/recipes-devtools/python/python-keystone | |
parent | 1b62d4b061a69a83de795bba76064d5bf7bfd379 (diff) | |
download | meta-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.sh | 90 |
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 |
32 | ADMIN_TENANT=$(keystone tenant-create --name=admin | grep " id " | get_field 2) | 32 | keystone tenant-get admin |
33 | DEMO_TENANT=$(keystone tenant-create --name=demo | grep " id " | get_field 2) | 33 | if [ $? -eq 1 ]; then |
34 | SERVICE_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) |
35 | else | ||
36 | ADMIN_TENANT=$(keystone tenant-get admin | grep " id " | get_field 2) | ||
37 | fi | ||
38 | keystone tenant-get demo | ||
39 | if [ $? -eq 1 ]; then | ||
40 | DEMO_TENANT=$(keystone tenant-create --name=demo | grep " id " | get_field 2) | ||
41 | else | ||
42 | DEMO_TENANT=$(keystone tenant-get demo | grep " id " | get_field 2) | ||
43 | fi | ||
44 | keystone tenant-get $SERVICE_TENANT_NAME | ||
45 | if [ $? -eq 1 ]; then | ||
46 | SERVICE_TENANT=$(keystone tenant-create --name=$SERVICE_TENANT_NAME | grep " id " | get_field 2) | ||
47 | else | ||
48 | SERVICE_TENANT=$(keystone tenant-get $SERVICE_TENANT_NAME | grep " id " | get_field 2) | ||
49 | fi | ||
35 | 50 | ||
36 | # Users | 51 | # Users |
37 | ADMIN_USER=$(keystone user-create --name=admin --pass="$ADMIN_PASSWORD" --email=admin@domain.com | grep " id " | get_field 2) | 52 | keystone user-get admin |
38 | DEMO_USER=$(keystone user-create --name=demo --pass="$DEMO_PASSWORD" --email=demo@domain.com --tenant-id=$DEMO_TENANT | grep " id " | get_field 2) | 53 | if [ $? -eq 1 ]; then |
39 | NOVA_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) |
40 | GLANCE_USER=$(keystone user-create --name=glance --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=glance@domain.com | grep " id " | get_field 2) | 55 | else |
41 | QUANTUM_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) |
42 | CINDER_USER=$(keystone user-create --name=cinder --pass="$SERVICE_PASSWORD" --tenant-id $SERVICE_TENANT --email=cinder@domain.com | grep " id " | get_field 2) | 57 | fi |
58 | keystone user-get demo | ||
59 | if [ $? -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) | ||
61 | else | ||
62 | DEMO_USER=$(keystone user-get demo | grep " id " | get_field 2) | ||
63 | fi | ||
64 | keystone user-get nova | ||
65 | if [ $? -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) | ||
67 | else | ||
68 | NOVA_USER=$(keystone user-get nova | grep " id " | get_field 2) | ||
69 | fi | ||
70 | keystone user-get glance | ||
71 | if [ $? -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) | ||
73 | else | ||
74 | GLANCE_USER=$(keystone user-get glance | grep " id " | get_field 2) | ||
75 | fi | ||
76 | keystone user-get quantum | ||
77 | if [ $? -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) | ||
79 | else | ||
80 | QUANTUM_USER=$(keystone user-get quantum | grep " id " | get_field 2) | ||
81 | fi | ||
82 | keystone user-get cinder | ||
83 | if [ $? -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) | ||
85 | else | ||
86 | CINDER_USER=$(keystone user-get cinder | grep " id " | get_field 2) | ||
87 | fi | ||
43 | 88 | ||
44 | # Roles | 89 | # Roles |
45 | ADMIN_ROLE=$(keystone role-create --name=admin | grep " id " | get_field 2) | 90 | keystone role-get admin |
46 | MEMBER_ROLE=$(keystone role-create --name=Member | grep " id " | get_field 2) | 91 | if [ $? -eq 1 ]; then |
92 | ADMIN_ROLE=$(keystone role-create --name=admin | grep " id " | get_field 2) | ||
93 | else | ||
94 | ADMIN_ROLE=$(keystone role-get admin | grep " id " | get_field 2) | ||
95 | fi | ||
96 | keystone role-get Member | ||
97 | if [ $? -eq 1 ]; then | ||
98 | MEMBER_ROLE=$(keystone role-create --name=Member | grep " id " | get_field 2) | ||
99 | else | ||
100 | MEMBER_ROLE=$(keystone role-get Member | grep " id " | get_field 2) | ||
101 | fi | ||
47 | 102 | ||
48 | # Add Roles to Users in Tenants | 103 | # Add Roles to Users in Tenants |
49 | keystone user-role-add --user-id $ADMIN_USER --role-id $ADMIN_ROLE --tenant-id $ADMIN_TENANT | 104 | keystone user-role-list --user-id $ADMIN_USER --tenant-id $ADMIN_TENANT &> /dev/null |
105 | keystone user-role-add --tenant-id $ADMIN_TENANT --user-id $ADMIN_USER --role-id $ADMIN_ROLE | ||
106 | |||
107 | keystone user-role-list --user-id $NOVA_USER --tenant-id $SERVICE_TENANT &> /dev/null | ||
50 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $ADMIN_ROLE | 108 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $NOVA_USER --role-id $ADMIN_ROLE |
109 | |||
110 | keystone user-role-list --user-id $GLANCE_USER --tenant-id $SERVICE_TENANT &> /dev/null | ||
51 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $GLANCE_USER --role-id $ADMIN_ROLE | 111 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $GLANCE_USER --role-id $ADMIN_ROLE |
112 | |||
113 | keystone user-role-list --user-id $QUANTUM_USER --tenant-id $SERVICE_TENANT &> /dev/null | ||
52 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $QUANTUM_USER --role-id $ADMIN_ROLE | 114 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $QUANTUM_USER --role-id $ADMIN_ROLE |
115 | |||
116 | keystone user-role-list --user-id $CINDER_USER --tenant-id $SERVICE_TENANT &> /dev/null | ||
53 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $CINDER_USER --role-id $ADMIN_ROLE | 117 | keystone user-role-add --tenant-id $SERVICE_TENANT --user-id $CINDER_USER --role-id $ADMIN_ROLE |
118 | |||
119 | keystone user-role-list --user-id $DEMO_USER --tenant-id $DEMO_TENANT &> /dev/null | ||
54 | keystone user-role-add --tenant-id $DEMO_TENANT --user-id $DEMO_USER --role-id $MEMBER_ROLE | 120 | keystone user-role-add --tenant-id $DEMO_TENANT --user-id $DEMO_USER --role-id $MEMBER_ROLE |
55 | 121 | ||
56 | # Create services | 122 | # Create services |