Python SDK: Could not find endpoint in service catalog
Hi Everyone,
My OpenStack deployment is Mitaka and the python client versions are as follows:
@vm305 ~]# rpm -qa | grep keystone
python2-keystoneauth1-2.4.1-1.el7.noarch
python-keystonemiddleware-4.4.1-1.el7.noarch
python-keystoneclient-2.3.1-2.el7.noarch
[root@vm305 ~]# rpm -qa | grep openstack
python2-openstacksdk-0.8.3-1.el7.noarch
openstack-dashboard-9.0.1-1.el7.noarch
openstack-horizon-scd-0.2-1.noarch
python-openstackclient-2.3.0-1.el7.noarch
python-django-openstack-auth-2.2.1-1.el7.noarch
I have run into a problem while attempting to use the Python SDK as described here https://docs.openstack.org/developer/python-keystoneclient/api/keystoneclient.v3.html#module-keystoneclient.v3.client (https://docs.openstack.org/developer/...) the example code I am using is:
from keystoneclient.v3 import client as ksclient
from keystoneauth1.identity import v3
from keystoneauth1 import session
import novaclient.client as client
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("/var/www/frontend/config/global.conf")
json = { "username":"admin","password":"SomePassword"}
NOVA_VERSION="2.1"
KEYSTONE_URL = config.get("global","keystone")
OPENSTACK_HOST = config.get("global","openstack_host")
OPENSTACK_DEFAULT_DOMAIN = config.get("global","openstack_default_domain")
auth = v3.Password(auth_url=KEYSTONE_URL, username=json.get("username"),password=json.get("password"),user_domain_name="default",domain_name="default")
print auth
sess = session.Session(auth=auth,verify='/etc/ssl/certs/ca-bundle/crt')
print sess
nova = client.Client(NOVA_VERSION,session=sess)
print nova
print sess.get_endpoint()
print sess.get_token()
print sess.get('/users', endpoint_filter={'service_type': 'identity',
'interface': 'admin',
'region_name': 'RegionOne'})
keystone = ksclient.Client(session=sess,endpoint=KEYSTONE_URL+"/v3")
print keystone
projects = keystone.projects.list()
print projects
The response I am getting is the following:
[root@vm305 ~]# python user.py
<keystoneauth1.identity.v3.password.Password object at 0x329cc90>
<keystoneauth1.session.Session object at 0x43d9650>
<novaclient.v2.client.Client object at 0x43d9990>
No handlers could be found for logger "keystoneauth.identity.base"
None
Traceback (most recent call last):
File "user.py", line 25, in <module>
print sess.get_token()
File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 840, in get_token
return (self.get_auth_headers(auth) or {}).get('X-Auth-Token')
File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 818, in get_auth_headers
return auth.get_headers(self, **kwargs)
File "/usr/lib/python2.7/site-packages/keystoneauth1/plugin.py", line 90, in get_headers
token = self.get_token(session)
File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 90, in get_token
return self.get_access(session).auth_token
File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 136, in get_access
self.auth_ref = self.get_auth_ref(session)
File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/v3/base.py", line 167, in get_auth_ref
authenticated=False, log=False, **rkwargs)
File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 766, in post
return self.request(url, 'POST', **kwargs)
File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 101, in inner
return wrapped(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 516, in request
raise exceptions.EndpointNotFound()
keystoneauth1.exceptions.catalog.EndpointNotFound: Could not find requested endpoint in Service Catalog.
When i run a regular openstack endpoint list
i get the following:
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+
| 17c49729f4b246189680dcf655b36d44 | RegionOne | neutron | network | True | admin | https ...