Last active
December 16, 2015 21:59
-
-
Save kojiwell/5503473 to your computer and use it in GitHub Desktop.
There is an example to get user by USER_ID on the keystone-api documentation.(https://keystoneclient.readthedocs.org/en/latest/api.html) But usually we want to get user by USER_NAME. Here's the way to do that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | |
from keystoneclient.v2_0 import client | |
from keystoneclient import utils | |
keystone = client.Client(username='admin', | |
password='admin_password', | |
tenant_name='admin_tenant', | |
cacert='/path/to/cacert.pem', | |
auth_url='https://keystone.domain.org:35357/v2.0/') | |
# Get user by USER_NAME instead of USER_ID | |
user = utils.find_resource(keystone.users, USER_NAME) | |
# Referred links | |
# https://keystoneclient.readthedocs.org/en/latest/api.html | |
# http://stackoverflow.com/questions/15525297/openstack-keystoneclient-get-user-by-name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment