Ask Your Question
0

How to detect keystone version

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

George Shuklin gravatar image

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

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(
    auth_url=e['OS_AUTH_URL'],
    username=e['OS_USERNAME'],
    password=e['OS_PASSWORD'],
    tenant_name=e['OS_TENANT_NAME']
)
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
0

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

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

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: 2017-01-29 16:07:52 -0500

Seen: 916 times

Last updated: Jan 30 '17