How to connect to OpenStack Keystone API using keystoneclient
>>>import keystoneclient
>>>from keystoneclient.v2_0 import client
>>>keystone = client.Client(username="admin", password="*****", tenant_name="admin", auth_url="http://192.168.56.101:5000/v2.0", debug=True)
>>> print keystone.tenants.list()
[<Tenant {u'enabled': True, u'description': None, u'name': u'admin', u'id': u'13b447285765463b8f4836f5cbb80f05'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'service', u'id': u'9369242879854fa19630a7aa1a7c30d9'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'invisible_to_admin', u'id': u'9b478397b98f4e8d9693128be8ddd2fb'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'demo', u'id': u'aa02b89cb14748ca9eb77788b9189075'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'alt_demo', u'id': u'b8b6ba4eacf14037925f5b239d6a9fd0'}>]
>>>
>>>
>>>
>>>
>>>
>>> keystone.tenants.list()
[<Tenant {u'enabled': True, u'description': None, u'name': u'admin', u'id': u'13b447285765463b8f4836f5cbb80f05'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'service', u'id': u'9369242879854fa19630a7aa1a7c30d9'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'invisible_to_admin', u'id': u'9b478397b98f4e8d9693128be8ddd2fb'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'demo', u'id': u'aa02b89cb14748ca9eb77788b9189075'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'alt_demo', u'id': u'b8b6ba4eacf14037925f5b239d6a9fd0'}>]
>>>
Comments
Post a Comment