Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add param for unsafe advisory conflict resolution #274

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions manifests/plugin/rpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
# 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 allow_automatic_unsafe_advisory_conflict_resolution
# Allow resolving of conflicts due to duplicate advisory ids with different creation dates
# https://docs.pulpproject.org/pulp_rpm/settings.html#allow-automatic-unsafe-advisory-conflict-resolution
class pulpcore::plugin::rpm (
Boolean $use_pulp2_content_route = false,
Optional[Integer[0]] $keep_changelog_limit = undef,
Boolean $allow_automatic_unsafe_advisory_conflict_resolution = false,
) {
if $use_pulp2_content_route {
$context = {
Expand All @@ -34,8 +39,11 @@
$content = undef
}

if $keep_changelog_limit {
$rpm_plugin_config = "KEEP_CHANGELOG_LIMIT = ${keep_changelog_limit}"
if $keep_changelog_limit or $allow_automatic_unsafe_advisory_conflict_resolution {
$rpm_plugin_config = epp('pulpcore/settings-rpm.py.epp', {
'allow_auacr' => $allow_automatic_unsafe_advisory_conflict_resolution,
'keep_changelog_limit' => $keep_changelog_limit,
})
} else {
$rpm_plugin_config = undef
}
Expand Down
12 changes: 11 additions & 1 deletion spec/classes/plugin_rpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@
is_expected.not_to contain_concat__fragment('plugin-rpm')
end

context 'with allow_unsafe_advisory_conflict_resolution' do
let(:params) { { allow_automatic_unsafe_advisory_conflict_resolution: true } }

it 'configures pulpcore with ALLOW_AUTOMATIC_UNSAFE_ADVISORY_CONFLICT_RESOLUTION' do
is_expected.to compile.with_all_deps
is_expected.to contain_concat__fragment('plugin-rpm')
.with_content("\n# rpm plugin settings\nALLOW_AUTOMATIC_UNSAFE_ADVISORY_CONFLICT_RESOLUTION = True\n")
end
end

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

it 'configures 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")
.with_content("\n# rpm plugin settings\nKEEP_CHANGELOG_LIMIT = 20\n")
end
end

Expand Down
9 changes: 9 additions & 0 deletions templates/settings-rpm.py.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%- | Boolean $allow_auacr,
Optional[Integer[0]] $keep_changelog_limit
| -%>
<%- if $keep_changelog_limit { -%>
KEEP_CHANGELOG_LIMIT = <%= $keep_changelog_limit %>
<%- } -%>
<%- if $allow_auacr { -%>
ALLOW_AUTOMATIC_UNSAFE_ADVISORY_CONFLICT_RESOLUTION = True
<%- } -%>