Skip to content

Commit

Permalink
Move KEEP_CHANGELOG_LIMIT to pulpcore::rpm::plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Jan 25, 2022
1 parent b362e38 commit fe6426e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
4 changes: 0 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@
# @param allowed_content_checksums
# List of checksum types to allow for content operations
#
# @param keep_changelog_limit
# Pulpcore's KEEP_CHANGELOG_LIMIT setting. Uses Pulpcore's default when undefined. Increasing this limit will cause pulpcore workers to use more memory when more changelogs are available in the repo metadata.
#
# @param worker_count
# Number of pulpcore workers. Defaults to 8 or the number of CPU cores, whichever is smaller. Enabling more than 8 workers, even with additional CPU cores
# available, likely results in performance degradation due to I/O blocking and is not recommended in most cases. Modifying this parameter should
Expand Down Expand Up @@ -219,7 +216,6 @@
Array[Stdlib::Absolutepath] $allowed_import_path = ['/var/lib/pulp/sync_imports'],
Array[Stdlib::Absolutepath] $allowed_export_path = [],
Pulpcore::ChecksumTypes $allowed_content_checksums = ['sha224', 'sha256', 'sha384', 'sha512'],
Integer[1] $keep_changelog_limit = undef,
String[1] $remote_user_environ_name = 'HTTP_REMOTE_USER',
Integer[0] $worker_count = min(8, $facts['processors']['count']),
Optional[Integer[0]] $worker_ttl = undef,
Expand Down
11 changes: 11 additions & 0 deletions manifests/plugin/rpm.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# @summary Pulp RPM plugin
# @param use_pulp2_content_route
# Whether to redirect the legacy (Pulp 2) URLs to the content server
#
# @param keep_changelog_limit
# Pulpcore's KEEP_CHANGELOG_LIMIT setting. Uses Pulpcore's default when undefined. Increasing this limit will cause pulpcore workers to use more memory when more changelogs are available in the repo metadata.
class pulpcore::plugin::rpm (
Boolean $use_pulp2_content_route = false,
Optional[Integer[0]] $keep_changelog_limit = undef,
) {
if $use_pulp2_content_route {
$context = {
Expand All @@ -28,8 +32,15 @@
$content = undef
}

if $keep_changelog_limit {
$rpm_plugin_config = "KEEP_CHANGELOG_LIMIT = ${keep_changelog_limit}"
} else {
$rpm_plugin_config = undef
}

pulpcore::plugin { 'rpm':
http_content => $content,
https_content => $content,
config => $rpm_plugin_config,
}
}
11 changes: 11 additions & 0 deletions spec/classes/plugin_rpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
is_expected.to contain_pulpcore__plugin('rpm')
.that_subscribes_to('Class[Pulpcore::Install]')
.that_notifies(['Class[Pulpcore::Database]', 'Class[Pulpcore::Service]'])
is_expected.not_to contain_concat__fragment('plugin-rpm')
end

context 'with keep_changelog_limit' do
let(:params) { { keep_changelog_limit: 20 } }

it 'configues pulpcore with KEEP_CHANGELOG_LIMIT' do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('plugin-rpm')
.with_content("\n# rpm plugin settings\nKEEP_CHANGELOG_LIMIT = 20")
end
end

context 'with pulp2 content route' do
Expand Down
15 changes: 0 additions & 15 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
.with_content(%r{CACHE_ENABLED = False})
.without_content(%r{sslmode})
.without_content(%r{WORKER_TTL})
.without_content(%r{KEEP_CHANGELOG_LIMIT})
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/etc/pulp/certs/database_fields.symmetric.key')
is_expected.to contain_file('/var/lib/pulp')
Expand Down Expand Up @@ -181,20 +180,6 @@
end
end

context 'with keep_changelog_limit' do
let :params do
{
keep_changelog_limit: 20,
}
end

it do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('base')
.with_content(%r{KEEP_CHANGELOG_LIMIT = 20})
end
end

context 'with worker_count set to 5' do
let(:params) { { worker_count: 5 } }

Expand Down
3 changes: 0 additions & 3 deletions templates/settings.py.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (
ALLOWED_IMPORT_PATHS = <%= scope['pulpcore::allowed_import_path'] %>
ALLOWED_EXPORT_PATHS = <%= scope['pulpcore::allowed_export_path'] %>
ALLOWED_CONTENT_CHECKSUMS = <%= scope['pulpcore::allowed_content_checksums'] %>
<% if scope['pulpcore::keep_changelog_limit'] -%>
KEEP_CHANGELOG_LIMIT = <%= scope['pulpcore::keep_changelog_limit'] %>
<% end -%>

# Derive HTTP/HTTPS via the X-Forwarded-Proto header set by Apache
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Expand Down

0 comments on commit fe6426e

Please sign in to comment.