Browse code

Use openstack CLI instead of keystone

When running './stack.sh' messages are output stating that
the keystone CLI has been deprecated. These calls should be
replaced to ones utilizing the openstack CLI program instead.

Documentation examples were also updated to reflect the new syntax.

Change-Id: Ib20b8940e317d150e5f6febb618e20bd85d13f8b
Closes-Bug: #1441340

Peter Stachowski authored on 2015/04/09 04:48:09
Showing 7 changed files
... ...
@@ -13,7 +13,7 @@ EC2\_URL
13 13
 
14 14
     ::
15 15
 
16
-        EC2_URL=$(keystone catalog --service ec2 | awk '/ publicURL / { print $4 }')
16
+        EC2_URL=$(openstack catalog show ec2 | awk '/ publicURL: / { print $4 }')
17 17
 
18 18
 S3\_URL
19 19
     Set the S3 endpoint for euca2ools. The endpoint is extracted from
... ...
@@ -21,14 +21,14 @@ S3\_URL
21 21
 
22 22
     ::
23 23
 
24
-        export S3_URL=$(keystone catalog --service s3 | awk '/ publicURL / { print $4 }')
24
+        export S3_URL=$(openstack catalog show s3 | awk '/ publicURL: / { print $4 }')
25 25
 
26 26
 EC2\_ACCESS\_KEY, EC2\_SECRET\_KEY
27 27
     Create EC2 credentials for the current tenant:user in Keystone.
28 28
 
29 29
     ::
30 30
 
31
-        CREDS=$(keystone ec2-credentials-create)
31
+        CREDS=$(openstack ec2 credentials create)
32 32
         export EC2_ACCESS_KEY=$(echo "$CREDS" | awk '/ access / { print $4 }')
33 33
         export EC2_SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }')
34 34
 
... ...
@@ -229,10 +229,10 @@ Additional Users
229 229
 ----------------
230 230
 
231 231
 DevStack creates two OpenStack users (``admin`` and ``demo``) and two
232
-tenants (also ``admin`` and ``demo``). ``admin`` is exactly what it
232
+projects (also ``admin`` and ``demo``). ``admin`` is exactly what it
233 233
 sounds like, a privileged administrative account that is a member of
234
-both the ``admin`` and ``demo`` tenants. ``demo`` is a normal user
235
-account that is only a member of the ``demo`` tenant. Creating
234
+both the ``admin`` and ``demo`` projects. ``demo`` is a normal user
235
+account that is only a member of the ``demo`` project. Creating
236 236
 additional OpenStack users can be done through the dashboard, sometimes
237 237
 it is easier to do them in bulk from a script, especially since they get
238 238
 blown away every time ``stack.sh`` runs. The following steps are ripe
... ...
@@ -243,21 +243,21 @@ for scripting:
243 243
     # Get admin creds
244 244
     . openrc admin admin
245 245
 
246
-    # List existing tenants
247
-    keystone tenant-list
246
+    # List existing projects
247
+    openstack project list
248 248
 
249 249
     # List existing users
250
-    keystone user-list
250
+    openstack user list
251 251
 
252
-    # Add a user and tenant
252
+    # Add a user and project
253 253
     NAME=bob
254 254
     PASSWORD=BigSecrete
255
-    TENANT=$NAME
256
-    keystone tenant-create --name=$NAME
257
-    keystone user-create --name=$NAME --pass=$PASSWORD
258
-    keystone user-role-add --user-id=<bob-user-id> --tenant-id=<bob-tenant-id> --role-id=<member-role-id>
259
-    # member-role-id comes from the existing member role created by stack.sh
260
-    # keystone role-list
255
+    PROJECT=$NAME
256
+    openstack project create $PROJECT
257
+    openstack user create $NAME --password=$PASSWORD --project $PROJECT
258
+    openstack role add Member --user $NAME --project $PROJECT
259
+    # The Member role is created by stack.sh
260
+    # openstack role list
261 261
 
262 262
 Swift
263 263
 -----
... ...
@@ -19,7 +19,7 @@ RC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
19 19
 source $RC_DIR/openrc
20 20
 
21 21
 # Set the ec2 url so euca2ools works
22
-export EC2_URL=$(keystone catalog --service ec2 | awk '/ publicURL / { print $4 }')
22
+export EC2_URL=$(openstack catalog show ec2 | awk '/ publicURL: / { print $4 }')
23 23
 
24 24
 # Create EC2 credentials for the current user
25 25
 CREDS=$(openstack ec2 credentials create)
... ...
@@ -29,7 +29,7 @@ export EC2_SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }')
29 29
 # Euca2ools Certificate stuff for uploading bundles
30 30
 # See exercises/bundle.sh to see how to get certs using nova cli
31 31
 NOVA_KEY_DIR=${NOVA_KEY_DIR:-$RC_DIR}
32
-export S3_URL=$(keystone catalog --service s3 | awk '/ publicURL / { print $4 }')
32
+export S3_URL=$(openstack catalog show s3 | awk '/ publicURL: / { print $4 }')
33 33
 export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
34 34
 export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
35 35
 export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
... ...
@@ -69,7 +69,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
69 69
         STATUS_KEYSTONE="Skipped"
70 70
     else
71 71
         echo -e "\nTest Keystone"
72
-        if keystone $TENANT_ARG $ARGS catalog --service identity; then
72
+        if openstack $TENANT_ARG $ARGS catalog show identity; then
73 73
             STATUS_KEYSTONE="Succeeded"
74 74
         else
75 75
             STATUS_KEYSTONE="Failed"
... ...
@@ -765,7 +765,7 @@ function upload_baremetal_ironic_deploy {
765 765
         fi
766 766
     fi
767 767
 
768
-    local token=$(keystone token-get | grep ' id ' | get_field 2)
768
+    local token=$(openstack token issue -c id -f value)
769 769
     die_if_not_set $LINENO token "Keystone fail to get token"
770 770
 
771 771
     # load them into glance
... ...
@@ -1173,7 +1173,7 @@ fi
1173 1173
 # See https://help.ubuntu.com/community/CloudInit for more on ``cloud-init``
1174 1174
 
1175 1175
 if is_service_enabled g-reg; then
1176
-    TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
1176
+    TOKEN=$(openstack token issue -c id -f value)
1177 1177
     die_if_not_set $LINENO TOKEN "Keystone fail to get token"
1178 1178
 
1179 1179
     echo_summary "Uploading images"
... ...
@@ -32,7 +32,7 @@ if [[ -z "$1" ]]; then
32 32
 fi
33 33
 
34 34
 # Get a token to authenticate to glance
35
-TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
35
+TOKEN=$(openstack token issue -c id -f value)
36 36
 die_if_not_set $LINENO TOKEN "Keystone fail to get token"
37 37
 
38 38
 # Glance connection info.  Note the port must be specified.