How to detect keystone version

asked 2017-01-29 16:07:52 -0600

George Shuklin gravatar image

updated 2017-01-29 16:08:30 -0600

I'm writing application with novaclient and I want to use keystoneauth1.session object (together with keystoneauth1.identity).

I don't know which version would be running on remote server (I'm writing generic application to work with any installation of Openstack). I can use 'v2' or 'v3' versions. Is any way to ask remote (keystone) server about it's preferable version?

My current code (with some cutoffs):

import os
from novaclient import client as novaclient
from keystoneauth1.identity import v2
from keystoneauth1 import session
from keystoneclient import client as keystoneclient
e = os.environ
auth = v2.Password(
sess = session.Session(auth=auth)
nova = novaclient.Client('2', session=sess)
print nova.flavors.list()

I have similar code for v3 (with different names - 'project_name' instead of 'tenant_name', etc. How should I choose one?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-30 01:09:50 -0600

Mohit gravatar image

To find keystone version You can curl http://your-address:5000 . This is out of python scope.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-01-29 16:07:52 -0600

Seen: 2,028 times

Last updated: Jan 30 '17