Ask Your Question
0

keystone.tenants.create() Unexpected error: <class 'keystoneclient.exceptions.NotFound'> in v2.0

asked 2016-03-17 13:02:24 -0500

genie gravatar image

updated 2016-03-18 13:57:47 -0500

keystone.tenants.create() Unexpected error: <class 'keystoneclient.exceptions.notfound'="">

there is no keystoneclient.exceptions module when i use from keystoneclient.exceptions to import

how to show and fix this error

updated code run in python interactive mode

from keystoneclient.v2_0 import client
token = '7c498f567252456680a87d4beb25ff44'
endpoint = 'http://192.168.157.131:5000/v2.0'
keystone = client.Client(token=token, endpoint=endpoint)
keystone.tenants.list()
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-03-17 15:05:49 -0500

dbaxps gravatar image

updated 2016-03-18 14:57:09 -0500

UPDATE 03/18/16
See http://www.ibm.com/developerworks/clo...

Listing 5. credentials.py
Listing 6. Successfully authenticating against a keystone endpoint in an interactive Python session 
Listing 7. Creating a user, tenant, and role
Listing 8. Creating a service and endpoint
Listing 9. Querying for the glance endpoint in an interactive Python session

END UPDATE

UPDATE

Admin token is in the top of /etc/keystone/keystone.conf

END UPDATE
Using the V2 client API

[root@ServerCenttOS01 ~]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] 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'e463fca1ca154a11a400499c494ca328'}>
>>> keystone.tenants.list()
[<Tenant {u'enabled': True, u'description': u'default tenant', u'name': u'demo', u'id': u'06f56a00961e4c3ea10b537df8c86e1b'}>, <Tenant {u'enabled': True, u'description': u'Tenant for the openstack services', u'name': u'services', u'id': u'45f21a5d2563415cb8f9eb6e3a775c18'}>, <Tenant {u'enabled': True, u'description': u'Default Tenant', u'name': u'openstackDemo', u'id': u'e463fca1ca154a11a400499c494ca328'}>, <Tenant {u'enabled': True, u'description': u'admin tenant', u'name': u'admin', u'id': u'ec18a949efd8430b9a2b0b908501562b'}>]
>>>

Regarding Using the V3 Client API see http://docs.openstack.org/developer/p...

edit flag offensive delete link more

Comments

where can find token?, i use admin user id as token ,or demo user is as token,keystoneclient.exceptions.Unauthorized: The request you have made requires authentication. (HTTP 401)

genie gravatar imagegenie ( 2016-03-17 18:32:54 -0500 )edit

/etc/keystone/keystone.conf in the top - token for admin.

dbaxps gravatar imagedbaxps ( 2016-03-18 02:49:39 -0500 )edit

"i use admin user id as token " that is mistake

dbaxps gravatar imagedbaxps ( 2016-03-18 02:50:41 -0500 )edit

i have used "cat /etc/keystone/keystone.conf | grep admin_token" , still have error 401 unauthorized, where is wrong?

genie gravatar imagegenie ( 2016-03-18 12:03:42 -0500 )edit

Please, take file in vi (it is text). You will see admin token in first rows.

dbaxps gravatar imagedbaxps ( 2016-03-18 13:07:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-03-17 13:02:24 -0500

Seen: 211 times

Last updated: Mar 18 '16