diff --git a/config.yaml b/config.yaml index e9d747ef..e18e8731 100644 --- a/config.yaml +++ b/config.yaml @@ -357,3 +357,10 @@ options: twice the number of CPU cores a service unit has. When deployed in a LXD container, this default value will be capped to 4 workers unless this configuration option is set. + api-result-limit: + type: int + default: + description: | + The maximum number of objects (e.g. Swift objects or Glance images) to + display on a single page before providing a paging element (a “more” link) + to paginate results. diff --git a/hooks/horizon_contexts.py b/hooks/horizon_contexts.py index 6b74a835..3b5d6443 100644 --- a/hooks/horizon_contexts.py +++ b/hooks/horizon_contexts.py @@ -198,6 +198,8 @@ class HorizonContext(OSContextGenerator): 'multi_domain': False if config('default-domain') else True, "default_create_volume": config("default-create-volume"), 'image_formats': config('image-formats'), + 'api_result_limit': config('api-result-limit') + if config('api-result-limit') > 0 else 1000, } return ctxt diff --git a/templates/icehouse/local_settings.py b/templates/icehouse/local_settings.py index d4350a4f..3e8cc0a3 100644 --- a/templates/icehouse/local_settings.py +++ b/templates/icehouse/local_settings.py @@ -237,7 +237,7 @@ SECONDARY_ENDPOINT_TYPE = "{{ secondary_endpoint }}" # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link) # to paginate results. -API_RESULT_LIMIT = 1000 +API_RESULT_LIMIT = {{ api_result_limit }} API_RESULT_PAGE_SIZE = 20 # The timezone of the server. This should correspond with the timezone diff --git a/templates/liberty/local_settings.py b/templates/liberty/local_settings.py index bc7bc0e4..e7e3e334 100644 --- a/templates/liberty/local_settings.py +++ b/templates/liberty/local_settings.py @@ -341,7 +341,7 @@ SECONDARY_ENDPOINT_TYPE = "{{ secondary_endpoint }}" # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link) # to paginate results. -API_RESULT_LIMIT = 1000 +API_RESULT_LIMIT = {{ api_result_limit }} API_RESULT_PAGE_SIZE = 20 # The size of chunk in bytes for downloading objects from Swift diff --git a/templates/mitaka/local_settings.py b/templates/mitaka/local_settings.py index ec930578..71909d16 100644 --- a/templates/mitaka/local_settings.py +++ b/templates/mitaka/local_settings.py @@ -421,7 +421,7 @@ SECONDARY_ENDPOINT_TYPE = "{{ secondary_endpoint }}" # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link) # to paginate results. -API_RESULT_LIMIT = 1000 +API_RESULT_LIMIT = {{ api_result_limit }} API_RESULT_PAGE_SIZE = 20 # The size of chunk in bytes for downloading objects from Swift diff --git a/templates/newton/local_settings.py b/templates/newton/local_settings.py index aea9c422..115298d1 100644 --- a/templates/newton/local_settings.py +++ b/templates/newton/local_settings.py @@ -456,7 +456,7 @@ SECONDARY_ENDPOINT_TYPE = "{{ secondary_endpoint }}" # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link) # to paginate results. -API_RESULT_LIMIT = 1000 +API_RESULT_LIMIT = {{ api_result_limit }} API_RESULT_PAGE_SIZE = 20 # The size of chunk in bytes for downloading objects from Swift diff --git a/templates/ocata/local_settings.py b/templates/ocata/local_settings.py index 3d43c562..ae2fba1a 100644 --- a/templates/ocata/local_settings.py +++ b/templates/ocata/local_settings.py @@ -459,7 +459,7 @@ SECONDARY_ENDPOINT_TYPE = "{{ secondary_endpoint }}" # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link) # to paginate results. -API_RESULT_LIMIT = 1000 +API_RESULT_LIMIT = {{ api_result_limit }} API_RESULT_PAGE_SIZE = 20 # The size of chunk in bytes for downloading objects from Swift diff --git a/unit_tests/test_horizon_contexts.py b/unit_tests/test_horizon_contexts.py index 8f5cea72..d101ca3d 100644 --- a/unit_tests/test_horizon_contexts.py +++ b/unit_tests/test_horizon_contexts.py @@ -139,6 +139,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -164,6 +165,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -189,6 +191,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -214,6 +217,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -240,6 +244,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -269,6 +274,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -294,6 +300,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -319,6 +326,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -349,6 +357,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -374,6 +383,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -399,6 +409,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -425,6 +436,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": True, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -451,6 +463,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": False, "image_formats": '', + "api_result_limit": 1000, } ) @@ -477,6 +490,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": 'iso qcow2 raw', + "api_result_limit": 1000, } )