diff --git a/config.yaml b/config.yaml index af9afc41446bb6bca867631e9dacd52b140a894b..98077cec54e2ddc595a2a46ae3c1a47a346f79b8 100644 --- a/config.yaml +++ b/config.yaml @@ -364,3 +364,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 5e62afacf08b205b08f7f28886afe67934b853cc..5fd0ff7b9021078440a854dab30cb64e666cdf3e 100644 --- a/hooks/horizon_contexts.py +++ b/hooks/horizon_contexts.py @@ -199,6 +199,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 d4350a4fa96c427de5d5ef48da26c1e53160f526..3e8cc0a3fdc882a3233baf9e791ed2c187dcc19d 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 bc7bc0e472a7b979b4e2a1b772c91e53813a2013..e7e3e334def8be24f138edbd400366769817ed75 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 51523d1ed73f16659c923e72070012f38f37f4b6..cd83b2b08b3b6e8eaaa86102611a2ab828910151 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 2b6235bf12d991763f38b0f72f8fb6a4f2b38fef..11ae4928d1d5f006669b93b1364524002896fbea 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 7f452cb32db8688d955e89ed44c6cdac67f1398a..8b35d30fed526aa8e41f3c33c6bcf10a8242d10d 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 765b6958cd1fa245b7fdf84d9033a88c0efd8c2d..58b9dd4ce5a3749f13a6a223923875aedf923792 100644 --- a/unit_tests/test_horizon_contexts.py +++ b/unit_tests/test_horizon_contexts.py @@ -144,6 +144,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -170,6 +171,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -196,6 +198,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -222,6 +225,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -249,6 +253,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -279,6 +284,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -305,6 +311,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -331,6 +338,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -362,6 +370,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -388,6 +397,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -414,6 +424,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -441,6 +452,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": True, "default_create_volume": True, "image_formats": '', + "api_result_limit": 1000, } ) @@ -468,6 +480,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": False, "image_formats": '', + "api_result_limit": 1000, } ) @@ -495,6 +508,7 @@ class TestHorizonContexts(CharmTestCase): "allow_password_autocompletion": False, "default_create_volume": True, "image_formats": 'iso qcow2 raw', + "api_result_limit": 1000, } )