How to get list of all servers through token based authetication

asked 2015-08-27 08:09:27 -0500

neelabhsingh gravatar image

I want to use token to get list of all serves, I know how to access severs list through username and password,

   from novaclient import client
   auth=v2.Password(auth_url="http://192.168.206.133:5000/v2.0/", username="admin", password="1234", tenant_id='020377f522324546b072af92862e6466')
    sess=keystonesession.Session(auth=auth,verify=False)
    nova = client.Client(2, session=sess)   
    instances =nova.servers.list()

Above is based on user name and password, but not token based I tried following but not woking

  from novaclient import client
  token =session.get("auth_token") # I have created token and accessing through session 
  noav=client.Client(token=token, endpoint='http://10.0.2.15:8774/v2.0/') 
  instances =nova.servers.list()
edit retag flag offensive close merge delete