Showing with 55 additions and 4 deletions.
  1. +9 −0 CHANGELOG.md
  2. +5 −0 manifests/init.pp
  3. +1 −1 metadata.json
  4. +34 −0 spec/acceptance/settings_spec.rb
  5. +0 −3 spec/setup_acceptance_node.pp
  6. +6 −0 templates/settings.py.erb
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [8.4.0](https://github.com/theforeman/puppet-pulpcore/tree/8.4.0) (2023-08-22)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/8.3.0...8.4.0)

**Implemented enhancements:**

- allow configuring IMPORT\_WORKERS\_PERCENT [\#302](https://github.com/theforeman/puppet-pulpcore/pull/302) ([evgeni](https://github.com/evgeni))
- don't setup ansible-29 repo in acceptance tests [\#301](https://github.com/theforeman/puppet-pulpcore/pull/301) ([evgeni](https://github.com/evgeni))

## [8.3.0](https://github.com/theforeman/puppet-pulpcore/tree/8.3.0) (2023-08-16)

[Full Changelog](https://github.com/theforeman/puppet-pulpcore/compare/8.2.0...8.3.0)
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
# If activated, the distributions that are protected by a content guard will not be shown on the
# directory listing in the content app.
#
# @param import_workers_percent
# What percentage of available-workers will pulpcore use for import tasks at a time.
# By default, pulpcore will use all available workers.
#
# @example Default configuration
# include pulpcore
#
Expand Down Expand Up @@ -252,6 +256,7 @@
Hash[String[1], Pulpcore::Logger] $loggers = {},
Optional[Boolean] $telemetry = undef,
Optional[Boolean] $hide_guarded_distributions = undef,
Optional[Integer[1,100]] $import_workers_percent = undef,
) {
$settings_file = "${config_dir}/settings.py"
$certs_dir = "${config_dir}/certs"
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-pulpcore",
"version": "8.3.0",
"version": "8.4.0",
"author": "theforeman",
"summary": "Installs next generation Pulp server",
"license": "GPL-3.0-or-later",
Expand Down
34 changes: 34 additions & 0 deletions spec/acceptance/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,37 @@ class { 'pulpcore':
end
end
end

describe 'IMPORT_WORKERS_PERCENT setting' do
context 'default IMPORT_WORKERS_PERCENT' 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.to match(/^# IMPORT_WORKERS_PERCENT = 100$/) }
end
end

context 'IMPORT_WORKERS_PERCENT set' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'pulpcore':
import_workers_percent => 42,
}
PUPPET
end
end

describe file('/etc/pulp/settings.py') do
it { is_expected.to be_file }
its(:content) { is_expected.to match(/^IMPORT_WORKERS_PERCENT = 42$/) }
end
end
end
3 changes: 0 additions & 3 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
package { 'glibc-langpack-en':
ensure => installed,
}
package { 'centos-release-ansible-29':
ensure => present,
}
}
default: {}
}
Expand Down
6 changes: 6 additions & 0 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@ CACHE_SETTINGS = {
<% else -%>
HIDE_GUARDED_DISTRIBUTIONS = <%= scope.call_function('to_python', [scope['pulpcore::hide_guarded_distributions']]) %>
<% end -%>
<% if scope['pulpcore::import_workers_percent'].nil? -%>
# IMPORT_WORKERS_PERCENT = 100
<% else -%>
IMPORT_WORKERS_PERCENT = <%= scope['pulpcore::import_workers_percent'] %>
<% end -%>