Ask Your Question
1

Find which keystone API version is supported

asked 2016-10-16 09:18:32 -0600

RingWraiths gravatar image

I have multiple OpenStack environments ranging from JUNO to Mitaka. We make REST API call from our JAVA program to these servers. The problem is, we recently started using v3 REST API on the Mitaka server. Earlier we hardcoded the REST call to the keystone as v2, but now since we are using v3 as well is there a way I can determine which version of keystone REST API that server is running on.

As a temporary solution I first make a call to v3. Check the response. If response is an error code I make a v2 call.

I am hoping there is a better way to do this.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-10-17 05:19:27 -0600

Just issue an http GET to the "naked" Keystone URL, for example

curl http://your-address:5000
edit flag offensive delete link more

Comments

But when I do that it gets me the url endpoints of both v2 and v3. Not the one on which it is running on. So I get "http://x.x.x.x:5000/v3/" and "http://x.x.x.x:5000/v2.0/" when I make that curl. Still no way to determine to find out on which URL I have to make a request on.

RingWraiths gravatar imageRingWraiths ( 2016-10-17 08:17:33 -0600 )edit

Keystone is available on both the URLs, v2 and v3. Use the one you need. See here for differences: http://developer.openstack.org/api-ref/identity/v2/index.html (http://developer.openstack.org/api-re...) http://developer.openstack.org/api-ref/identity/v3/index.html (http://developer.openstack.org/api-re...)

hem gravatar imagehem ( 2016-10-17 11:01:03 -0600 )edit

If the root endpoint is returning both v2 and v3, that means the cloud supports both, so you can make a request on either. Note that keystone v2 is deprecated though (I think since Mitaka). The version response should have a status field indicating if it's CURRENT or SUPPORTED or DEPRECATED.

mriedem gravatar imagemriedem ( 2016-10-17 12:56:27 -0600 )edit

Basically, if you get both v2 and v3, and your client code can handle both, then use v3 over v2 given v2 is deprecated.

mriedem gravatar imagemriedem ( 2016-10-17 12:56:48 -0600 )edit

Even though it returns both, the OS_AUTH_URL is explicitly specified as either v2 or v3 but not both. And this is the URL I am supposed to make a call to. I am unable to to find out which one I am supposed to.

RingWraiths gravatar imageRingWraiths ( 2016-10-17 13:22:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-10-16 09:18:32 -0600

Seen: 1,837 times

Last updated: Oct 17 '16