Skip to content

Commit

Permalink
Add param for unsave advisory conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bucher authored and ekohl committed Feb 2, 2023
1 parent e76a504 commit 9dcc9df
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
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
<%- } -%>

0 comments on commit 9dcc9df

Please sign in to comment.