Finding a User on a Non-Default Domain

asked 2016-08-12 14:09:11 -0500

kknicks gravatar image

I have two domains on my OpenStack setup - 'default' and 'domain1'. Using the python API, I need to find a user(using the name attribute) on a non default domain. I tried to do it using the keystone client both as the default admin and domain1's admin.

  1. As the default Admin - If I use the UI I need to set the domain context to be able to view the users of another domain. Is there anyway I could do this using the Python API? As it stands the search is restricted to users of the default domain.

  2. As the domain1 admin - If I call the projects.find function as the domain1 admin, it returns a not authorized function as it tries to run the list_users function without setting the domain to domain1. Is there anyway to do that?

This is my code:

from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import clientcreds = get_keystone_creds() # gets the credentials from the environment
auth = v3.Password(**creds)
sess = session.Session(auth=auth)
ks = client.Client(session= sess)
user = ks.users.find(name = 'testuser')
edit retag flag offensive close merge delete