What is %(tenant_id)s in keystone endpoints

asked 2013-12-20 02:32:50 -0600

laocius gravatar image

In the tutorial from http://openstack.org says keystone endpoints should be set to something like http://HOST_IP:8774/v2/%25(tenant_id)s (http://HOST_IP:8774/v2/%(tenant_id)s) what does '%(tenant_id)s' here mean? Because in a lot of forums, I saw the endpoints are something like http://HOST_IP:8774/v2/$(tenant_id)s What does this '%' and '$' mean here; even, someone suggests to set endpoints exactly as http://HOST_IP:8774/v2.0 .

I am very confused. How does keystone resolve this tenant_id?



edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-12-20 08:55:58 -0600

jtopjian gravatar image

I think the % and $ are interchangeable.

%(tenant_id)s is a placeholder for the tenant_id of the user who is accessing the Keystone catalog. If you run the command keystone catalog, Keystone will return its service catalog but you'll notice that all occurrences of %(tenant_id)s have been replaced with the actual ID of the tenant.

Keystone resolves the tenant_id by using the environment variables you specified either on the command line or in an openrc file:

$ cat openrc
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD="password"
export OS_AUTH_URL="http://cloud.example.com:5000/v2.0/"
export OS_AUTH_STRATEGY=keystone
export OS_REGION_NAME=RegionOne

For example, here is my "Compute" service entry in /etc/keystone/default_catalog.templates:

# RegionOne/compute
catalog.RegionOne.compute.name = OpenStack Compute Service
catalog.RegionOne.compute.publicURL = http://cloud.example.com:8774/v2/%(tenant_id)s
catalog.RegionOne.compute.adminURL = http://cloud.example.com:8774/v2/%(tenant_id)s
catalog.RegionOne.compute.internalURL = http://cloud.example.com:8774/v2/%(tenant_id)s

Now I'll run the following commands:

$ source openrc
$ keystone catalog --service=compute

And here are the results:

Service: compute
|   Property  |                               Value                               |
|   adminURL  | http://cloud.example.com:8774/v2/00cb7ac024214aaf9df2f179452c8121 |
| internalURL | http://cloud.example.com:8774/v2/00cb7ac024214aaf9df2f179452c8121 |
|  publicURL  | http://cloud.example.com:8774/v2/00cb7ac024214aaf9df2f179452c8121 |
|    region   |                                  RegionOne                        |

Hope that helps,


edit flag offensive delete link more


Thanks Joe.

laocius gravatar imagelaocius ( 2013-12-23 01:28:42 -0600 )edit

answered 2015-10-05 04:14:01 -0600

Matt G gravatar image

I believe % is in the endpoints returned by Keystone v2 and $ is in the endpoints returned by Keystone v3.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-12-20 02:32:50 -0600

Seen: 4,129 times

Last updated: Dec 20 '13