Skip to content

Commit

Permalink
Filter out legacy_endpoint_id (bug 1152635)
Browse files Browse the repository at this point in the history
Change-Id: I176c3f4fec0a1fa544efb11cffd4837dedf8cace
  • Loading branch information
dolph committed Mar 12, 2013
1 parent dd7d4fd commit d2635d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions keystone/catalog/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,17 @@ class EndpointV3(controller.V3Controller):
collection_name = 'endpoints'
member_name = 'endpoint'

@classmethod
def filter_endpoint(cls, ref):
if 'legacy_endpoint_id' in ref:
ref.pop('legacy_endpoint_id')
return ref

@classmethod
def wrap_member(cls, context, ref):
ref = cls.filter_endpoint(ref)
return super(EndpointV3, cls).wrap_member(context, ref)

@controller.protected
def create_endpoint(self, context, endpoint):
ref = self._assign_unique_id(self._normalize_dict(endpoint))
Expand Down
4 changes: 4 additions & 0 deletions tests/test_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ def assertValidEndpointResponse(self, resp, *args, **kwargs):
def assertValidEndpoint(self, entity, ref=None):
self.assertIsNotNone(entity.get('interface'))
self.assertIsNotNone(entity.get('service_id'))

# this is intended to be an unexposed implementation detail
self.assertNotIn('legacy_endpoint_id', entity)

if ref:
self.assertEqual(ref['interface'], entity['interface'])
self.assertEqual(ref['service_id'], entity['service_id'])
Expand Down

0 comments on commit d2635d5

Please sign in to comment.