how to do username authentication

asked 2015-10-06 08:02:51 -0500

Chris Curvey gravatar image

I'm brand new to OpenStack, so if the answer is RFTM, I'd appreciate a pointer to the correct FM. :)

I've installed the devstack as per http://docs.openstack.org/developer/devstack/#all-in-one-single-machine (http://docs.openstack.org/developer/d...)

Now I'm trying to write a Python program to talk to the OpenStack environment, and I'm following the examples at http://docs.openstack.org/developer/python-keystoneclient/using-api-v3.html (http://docs.openstack.org/developer/p...)

this code:

from keystoneclient.v3 import client
keystone = client.Client(auth_url="http://{}:5000/v3".format(KEYSTONE_HOST),
                         username="admin", password="st@ckm3")
print keystone.projects.list()

raises 'keystoneclient.exceptions.EndpointNotFound' when calling keystone.projects.list()

This code:

from keystoneclient import client
keystone = client.Client(auth_url="http://{}:5000".format(KEYSTONE_HOST),
                     username="admin", password="st@ckm3")
keystone.projects.list()

raises 'keystoneclient.exceptions.MissingAuthPlugin'

This code works:

from keystoneclient.auth.identity import v3
from keystoneclient import session
from keystoneclient.v3 import client

auth = v3.Password(auth_url="http://{}:5000/v3".format(KEYSTONE_HOST),
                   user_id="a1c6f3a7050d4bb79b2f215c595b64ed", 
                   password="st@ckm3",
                   project_id="564d5b18ee144b7a83eb5945114fe9fe")  
sess = session.Session(auth=auth)
keystone = client.Client(session=sess)

print keystone.projects.list()

But how would I know the user_id and project_id without being able to connect to Keystone? (I'm getting it by looking it up through the Horizon interface.)

edit retag flag offensive close merge delete