Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 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://dev-openstack.nubes.rl.ac.uk:9696   |
| 1d05cac3a0f74da3a4160969c486bb88 | RegionOne | keystonev3   | identityv3     | True    | public    | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:5000/v3            |
| 2016bf15caaf4c60ad9ea0e31fd2116c | RegionOne | ceilometer   | metering       | True    | admin     | https://dev-openstack.nubes.rl.ac.uk:8777   |
| 24a94b5af8d748679432e4100b6b43f5 | RegionOne | nova         | compute        | True    | public    | https://dev-openstack.nubes.rl.ac.uk:8774/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| 2f0f7545f93241ccbf174162f8928556 | RegionOne | glance       | image          | True    | public    | http://dev-openstack.nubes.rl.ac.uk:9292    |
| 32be38659ca64a9c860ca6f34bd47807 | RegionOne | heat-cfn     | cloudformation | True    | internal  | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:8000/v1            |
| 5090bfed653b466194048de0c956eb18 | RegionOne | keystonev3   | identityv3     | True    | internal  | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:5000/v3            |
| 5730d8578004472780b21cb9f9254b97 | RegionOne | cinder       | volume         | True    | public    | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| 5d192da81f3c4905b1caf909b136121b | RegionOne | cinderv2     | volumev2       | True    | public    | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| 6b094fc7eb974bba90a560406db09c6c | RegionOne | heat-cfn     | cloudformation | True    | public    | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:8000/v1            |
| 72cf9e16340640d18ef78c45ebb285f4 | RegionOne | nova         | compute        | True    | admin     | https://dev-openstack.nubes.rl.ac.uk:8774/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| 7a1ba52dfbee4de683df77b7c0e6b94d | RegionOne | keystone     | identity       | True    | public    | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:5000/v3            |
| 7ba1b291a5604996bb565ead992045e1 | RegionOne | ceilometer   | metering       | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:8777   |
| 8220f86226e84e12a87e5fadbe55e759 | RegionOne | heat-cfn     | cloudformation | True    | admin     | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:8000/v1            |
| 86cf8bbd4ff34a26b008dd27e656da84 | RegionOne | cinderv2     | volumev2       | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| 8b299ce6c0994cc0b716137286c62b12 | RegionOne | ceilometer   | metering       | True    | public    | https://dev-openstack.nubes.rl.ac.uk:8777   |
| 8b60b532f18d4acebdae71ac7d510575 | RegionOne | heat         | orchestration  | True    | public    | https://dev-openstack.nubes.rl.ac.uk:8004/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| 90dfd38bd3424a8a95060c2ae4c61ac7 | RegionOne | heat-cfn     | cloudformation | True    | public    | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:8000/v1            |
| 9d059fbd02b94ec88f19bd0247abb6d5 | RegionOne | glance       | image          | True    | internal  | http://dev-openstack.nubes.rl.ac.uk:9292    |
| 9e56ccfb20964835a1128a2f6167c00f | RegionOne | keystonev3   | identityv3     | True    | admin     | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:35357/v3           |
| a6755e3d046d44938ebb88b3b6040d3f | RegionOne | neutron      | network        | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:9696   |
| a723eebf7d6342f3ad762d2b86ace525 | RegionOne | nova         | compute        | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:8774/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| a81dcaebce5f42b2ae4f6e94ce1baf08 | RegionOne | cinder       | volume         | True    | admin     | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| af375ea1683740aea9b6ee856e64c38e | RegionOne | heat         | orchestration  | True    | admin     | https://dev-openstack.nubes.rl.ac.uk:8004/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| cf6aa62d06294570831495936f8a2c91 | RegionOne | cinderv2     | volumev2       | True    | admin     | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 2/%(tenant_id)s                             |
| d116c357dabc47e79d947a6b78bd236d | RegionOne | neutron      | network        | True    | public    | https://dev-openstack.nubes.rl.ac.uk:9696   |
| db038d692605431fb81d20de7bae9b38 | RegionOne | cinder       | volume         | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:8776/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| e0976eacceaa43b3b1d67b71899bd5b3 | RegionOne | glance       | image          | True    | admin     | http://dev-openstack.nubes.rl.ac.uk:9292    |
| e92ef6f231bb4ac39cb7d1037216a39b | RegionOne | keystone     | identity       | True    | admin     | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:35357/v3           |
| ed016e2cdee5453ea1ba6f91d1e65986 | RegionOne | heat         | orchestration  | True    | internal  | https://dev-openstack.nubes.rl.ac.uk:8004/v |
|                                  |           |              |                |         |           | 1/%(tenant_id)s                             |
| f9d67945cfd74f38bc53f758b845145c | RegionOne | keystone     | identity       | True    | internal  | https://dev-                                |
|                                  |           |              |                |         |           | openstack.nubes.rl.ac.uk:5000/v3            |
+----------------------------------+-----------+--------------+----------------+---------+-----------+---------------------------------------------+

Does anyone have any ideas what might be the issue here?

Thanks in advance for your help

Alex