Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get list of all servers through token based authetication

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()