diff --git a/manifests/init.pp b/manifests/init.pp index 92a128ba..9cedbc8c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -73,6 +73,9 @@ # STATIC_URL setting. In reality this can also be just the path and doesn't # have to be a full URL. # +# @param page_size +# Configure the PAGE_SIZE setting for Pagination. +# # @param postgresql_db_name # Name of Pulp PostgreSQL database # @@ -220,6 +223,7 @@ String[1] $apache_vhost_priority = '10', Stdlib::Absolutepath $api_socket_path = '/run/pulpcore-api.sock', Stdlib::Absolutepath $content_socket_path = '/run/pulpcore-content.sock', + Optional[Integer[1]] $page_size = undef, String $postgresql_db_name = 'pulpcore', String $postgresql_db_user = 'pulp', String $postgresql_db_password = extlib::cache_data('pulpcore_cache_data', 'db_password', extlib::random_password(32)), diff --git a/spec/acceptance/settings_spec.rb b/spec/acceptance/settings_spec.rb index 9e2d4eee..fde5b9d2 100644 --- a/spec/acceptance/settings_spec.rb +++ b/spec/acceptance/settings_spec.rb @@ -51,6 +51,40 @@ class { 'pulpcore': end end +describe 'PAGE_SIZE setting' do + context 'default PAGE_SIZE' do + it_behaves_like 'an idempotent resource' do + let(:manifest) do + <<-PUPPET + include pulpcore + PUPPET + end + end + + describe file('/etc/pulp/settings.py') do + it { is_expected.to be_file } + its(:content) { is_expected.not_to match(/^REST_FRAMEWORK__PAGE_SIZE/) } + end + end + + context 'Custom PAGE_SIZE' do + it_behaves_like 'an idempotent resource' do + let(:manifest) do + <<-PUPPET + class { 'pulpcore': + page_size => 200, + } + PUPPET + end + end + + describe file('/etc/pulp/settings.py') do + it { is_expected.to be_file } + its(:content) { is_expected.to match(/^REST_FRAMEWORK__PAGE_SIZE = 200$/) } + end + end +end + describe 'HIDE_GUARDED_DISTRIBUTIONS setting' do context 'default HIDE_GUARDED_DISTRIBUTIONS' do it_behaves_like 'an idempotent resource' do diff --git a/templates/settings.py.erb b/templates/settings.py.erb index b3b92f68..9da793ac 100644 --- a/templates/settings.py.erb +++ b/templates/settings.py.erb @@ -52,6 +52,9 @@ WORKING_DIRECTORY = "<%= scope['pulpcore::cache_dir'] %>" REMOTE_USER_ENVIRON_NAME = '<%= scope['pulpcore::remote_user_environ_name'] %>' AUTHENTICATION_BACKENDS = ['pulpcore.app.authentication.PulpNoCreateRemoteUserBackend'] +<% unless scope['pulpcore::page_size'].nil? -%> +REST_FRAMEWORK__PAGE_SIZE = '<%= scope['pulpcore::page_size'] %>' +<% end -%> REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = ( 'rest_framework.authentication.SessionAuthentication', 'pulpcore.app.authentication.PulpRemoteUserAuthentication'