Ask Your Question

Revision history [back]

Syntax working for me on Kilo and Liberty : [

root@ip-192-169-142-127 ~]# python
Python 2.7.5 (default, Jun 24 2015, 00:41:19) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneclient.v2_0 import client
>>> token = '3ad2de159f9649afb0c342ba57e637d9'
>>> endpoint = 'http://192.169.142.127:35357/v2.0'
>>> keystone = client.Client(token=token, endpoint=endpoint)
>>> keystone.tenants.create(tenant_name="openstackDemo",description="Default Tenant", enabled=True)
<Tenant {u'enabled': True, u'description': u'Default Tenant', u'name': u'openstackDemo', u'id': u'6e6fde29b88443b9bb603030a548e9c3'}>
>>>

Verification via deprecated CLI

# keystone tenant-list
+----------------------------------+---------------+---------+
|                id                |      name     | enabled |
+----------------------------------+---------------+---------+
| 21c46e5eef01460e85b94cce4a11f2e4 |     admin     |   True  |
| 1b56b8d970a347abac8b49c630a034a3 |      demo     |   True  |
| 6e6fde29b88443b9bb603030a548e9c3 | openstackDemo |   True  |
| bba28301cd69444b9f142f4f8c20dbf1 |    services   |   True  |
+----------------------------------+---------------+---------+

Next

# cat /etc/keystone/keystone/conf
#
#admin_token = ADMIN
admin_token = 3ad2de159f9649afb0c342ba57e637d9

Syntax working for me on Kilo and Liberty : [:

root@ip-192-169-142-127 ~]# python
Python 2.7.5 (default, Jun 24 2015, 00:41:19) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneclient.v2_0 import client
>>> token = '3ad2de159f9649afb0c342ba57e637d9'
>>> endpoint = 'http://192.169.142.127:35357/v2.0'
>>> keystone = client.Client(token=token, endpoint=endpoint)
>>> keystone.tenants.create(tenant_name="openstackDemo",description="Default Tenant", enabled=True)
<Tenant {u'enabled': True, u'description': u'Default Tenant', u'name': u'openstackDemo', u'id': u'6e6fde29b88443b9bb603030a548e9c3'}>
>>>

Verification via deprecated CLI

# keystone tenant-list
+----------------------------------+---------------+---------+
|                id                |      name     | enabled |
+----------------------------------+---------------+---------+
| 21c46e5eef01460e85b94cce4a11f2e4 |     admin     |   True  |
| 1b56b8d970a347abac8b49c630a034a3 |      demo     |   True  |
| 6e6fde29b88443b9bb603030a548e9c3 | openstackDemo |   True  |
| bba28301cd69444b9f142f4f8c20dbf1 |    services   |   True  |
+----------------------------------+---------------+---------+

Next

# cat /etc/keystone/keystone/conf
#
#admin_token = ADMIN
admin_token = 3ad2de159f9649afb0c342ba57e637d9