Incorrect key in endpoint dictionary

Bug #1364463 reported by Sergey Kraynev
18
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Critical
David Stanek
python-keystoneclient
Fix Released
Medium
Sergey Kraynev

Bug Description

Keystone v3 has keyword 'region_id' in endpoint dictionary instead 'region'.
It leads to bug in when you try to get endpoint with specific region.

Changed in keystone:
assignee: nobody → Sergey Kraynev (skraynev)
Revision history for this message
Lance Bragstad (lbragstad) wrote :
Revision history for this message
Lance Bragstad (lbragstad) wrote :

There have been changes made to the catalog/controller.py to move away from using endpoint['region'] and using endpoint['region_id'] instead:

https://github.com/openstack/keystone/blob/67b474f4ba3428eca97a4a6faaaba5951253f236/keystone/catalog/controllers.py#L130

https://github.com/openstack/keystone/blob/67b474f4ba3428eca97a4a6faaaba5951253f236/keystone/catalog/controllers.py#L279-L290

Are you seeing a specific failure/KeyError with 'region' vs 'region_id'

Revision history for this message
Steven Hardy (shardy) wrote :

Heat bug which shows specific failure:

https://bugs.launchpad.net/heat/+bug/1364408

Revision history for this message
Sergey Kraynev (skraynev) wrote :

@Lance: I did not see exactly this message. I get:

ERROR: Property error : server: ImageId publicURL endpoint for image service in RegionOne region not found

I investigated it and found that according to [1] there are two ServiceCatalog classes for both versions (v2 and v3).
However there is one common parent class with shared methods:

_get_service_endpoints [2] and get_endpoints[3]

In get_endpoints we sort endpoints using keyword 'region' for both versions [4]. So in v3 this key is not presented in endpoint dictionary and as result we get empty list which later said that such endpoint was not found.

[1] https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/service_catalog.py
[2] https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/service_catalog.py#L138
[3] https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/service_catalog.py#L86
[4] https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/service_catalog.py#L132

Revision history for this message
Sergey Kraynev (skraynev) wrote :

To make sure which endpoints are presented you may do follow:

on vm with available v3 keystone:

skr@ubuntu:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from keystoneclient.v3 import client
>>> c = client.Client(username='admin', password='horizonpass', auth_url='http://127.0.0.1:5000/v3')
>>> c.auth_ref

For me one of the endpoint looks like:

u'catalog': [{u'endpoints': [{u'id': u'575d32d0acff4edfa4b7f97dcd027e47',
                               u'interface': u'admin',
                               u'region_id': u'RegionOne',
                               u'url': u'http://172.18.76.56:9292'},
                              {u'id': u'9e73ca304dc04ceba2a1b76de0df388a',
                               u'interface': u'internal',
                               u'region_id': u'RegionOne',
                               u'url': u'http://172.18.76.56:9292'},
                              {u'id': u'e004b731bcc243ecad2085871befe735',
                               u'interface': u'public',
                               u'region_id': u'RegionOne',
                               u'url': u'http://172.18.76.56:9292'}],

Revision history for this message
David Stanek (dstanek) wrote :

I'm looking at this now. If we broke compatibility then we need to fix it on the server side.

Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Critical
Dolph Mathews (dolph)
Changed in keystone:
status: New → Triaged
Dolph Mathews (dolph)
Changed in python-keystoneclient:
assignee: nobody → Sergey Kraynev (skraynev)
status: New → In Progress
Changed in keystone:
assignee: Sergey Kraynev (skraynev) → David Stanek (dstanek)
status: Triaged → In Progress
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
Changed in keystone:
milestone: none → juno-3
Revision history for this message
David Stanek (dstanek) wrote :

I have submitted a server side fix: https://review.openstack.org/#/c/118667

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/118667
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=37f2ad886050c26fa26f2cbe9aaa96c25fef3d14
Submitter: Jenkins
Branch: master

commit 37f2ad886050c26fa26f2cbe9aaa96c25fef3d14
Author: David Stanek <email address hidden>
Date: Wed Sep 3 15:48:20 2014 +0000

    Adds region back into the catalog endpoint

    This was removed as a side effect of this commit:
    8ea1b14e4d7cf6d67f9796e1b3d13f4cc198015b

    Change-Id: I495589e850cf110ff264ec800638c6673e6a98e0
    Closes-Bug: #1364463

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: juno-3 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/118383
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=8311708907604f473dbc56e10b9da61670540241
Submitter: Jenkins
Branch: master

commit 8311708907604f473dbc56e10b9da61670540241
Author: Sergey Kraynev <email address hidden>
Date: Fri Nov 21 09:57:23 2014 -0500

    Using correct keyword for region in v3

    Keystone v3 and v2 have different keywords in endpoint
    dictionary. This patch adds ability for keystone client for correct
    work with old and new API.

    Change-Id: I886b4c7ac3cbe08ac1b88f490e9ca92a90256961
    Closes-Bug: #1364463

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Changed in python-keystoneclient:
milestone: none → 1.2.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.