From 717917c576ebcc8f62131d874f27cd4ec285959f Mon Sep 17 00:00:00 2001 From: Adam Young Date: Thu, 3 Apr 2014 13:21:23 -0400 Subject: [PATCH] Remove legacy_endpoint_id and enabled from service catalog Those two fields are for internal use, and should not be in the token. The token size was expanding past the threshold where it could be passed between a wsgi process and Apache HTTPD, even for a basic, devstack sized catalog. This reduces the size. Change-Id: Ic8eb70e519a8a35fd05b497d917f9889e82b6e7f Closes-Bug: 1302075 --- keystone/catalog/backends/sql.py | 3 +++ keystone/contrib/endpoint_filter/backends/catalog_sql.py | 2 ++ keystone/tests/test_v3.py | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/keystone/catalog/backends/sql.py b/keystone/catalog/backends/sql.py index 61f112865d..5bb8512a4a 100644 --- a/keystone/catalog/backends/sql.py +++ b/keystone/catalog/backends/sql.py @@ -292,6 +292,9 @@ class Catalog(catalog.Driver): def make_v3_endpoint(endpoint): endpoint = endpoint.to_dict() del endpoint['service_id'] + del endpoint['legacy_endpoint_id'] + del endpoint['enabled'] + endpoint['url'] = core.format_url(endpoint['url'], d) return endpoint diff --git a/keystone/contrib/endpoint_filter/backends/catalog_sql.py b/keystone/contrib/endpoint_filter/backends/catalog_sql.py index a4f48506f4..65badb7d46 100644 --- a/keystone/contrib/endpoint_filter/backends/catalog_sql.py +++ b/keystone/contrib/endpoint_filter/backends/catalog_sql.py @@ -50,6 +50,8 @@ class EndpointFilterCatalog(sql.Catalog): self.get_service(service_id)) service = services[service_id] del endpoint['service_id'] + del endpoint['enabled'] + del endpoint['legacy_endpoint_id'] endpoint['url'] = catalog_core.format_url( endpoint['url'], d) # populate filtered endpoints diff --git a/keystone/tests/test_v3.py b/keystone/tests/test_v3.py index 4a2e09f8e0..de34b2effb 100644 --- a/keystone/tests/test_v3.py +++ b/keystone/tests/test_v3.py @@ -581,6 +581,15 @@ class RestfulTestCase(tests.SQLDriverOverrides, rest.RestfulTestCase): if require_catalog: self.assertIn('catalog', token) + + if isinstance(token['catalog'], list): + # only test JSON + for service in token['catalog']: + for endpoint in service['endpoints']: + self.assertNotIn('enabled', endpoint) + self.assertNotIn('legacy_endpoint_id', endpoint) + self.assertNotIn('service_id', endpoint) + # sub test for the OS-EP-FILTER extension enabled if endpoint_filter: # verify the catalog hs no more than the endpoints