Skip to content
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
14 changes: 10 additions & 4 deletions definitions/procedures/pulpcore/rpm_datarepair.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ class RpmDatarepair < ForemanMaintain::Procedure
include ForemanMaintain::Concerns::PulpCommon

metadata do
description 'Rename ContentArtifact relative_paths to match `{N-V-R.A.rpm}`'
description 'Run Pulp RPM data repair commands'
for_feature :pulpcore
end

def run
with_spinner('Running pulpcore-manager rpm-datarepair 4073') do
# Assumption: services are already started
execute!(pulpcore_manager('rpm-datarepair 4073'))
# Fix package_signing_fingerprint empty strings (SAT-42632 / PULP-1263)
# Do not fail if unavailable
with_spinner('Running pulpcore-manager rpm-datarepair 4007') do |spinner|
exit_status, output = execute_with_status(pulpcore_manager('rpm-datarepair 4007'))
if exit_status != 0 && output.include?("Unknown issue: '4007'")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to checking if the script exists since it's not RPM packaged yet.

spinner.update('Skipped pulpcore-manager rpm-datarepair 4007, not available')
elsif exit_status != 0
fail!(output)
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/satellite_upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def compose
add_steps(
Procedures::RefreshFeatures,
Procedures::Service::Start,
Procedures::Pulpcore::RpmDatarepair,
Procedures::Crond::Start,
Procedures::Timer::Start,
Procedures::SyncPlans::Enable,
Expand Down
24 changes: 20 additions & 4 deletions test/definitions/procedures/pulpcore/rpm_datarepair_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@

subject { Procedures::Pulpcore::RpmDatarepair.new }

it 'runs pulpcore-manager rpm-datarepair 4073' do
it 'runs rpm-datarepair 4007 when handler exists' do
assume_feature_present(:pulpcore)
assume_feature_present(:pulpcore_database, :services => [])
assume_feature_present(:service)

subject.expects(:execute!).with(
# Mock successful execution of 4007
subject.expects(:execute_with_status).with(
'PULP_SETTINGS=/etc/pulp/settings.py runuser -u pulp -- ' \
'pulpcore-manager rpm-datarepair 4073'
).once
'pulpcore-manager rpm-datarepair 4007'
).returns([0, ''])

result = run_procedure(subject)
assert result.success?
end

it 'gracefully skips rpm-datarepair 4007 if handler does not exist' do
assume_feature_present(:pulpcore)
assume_feature_present(:pulpcore_database, :services => [])
assume_feature_present(:service)

# Mock 4007 handler not existing
subject.expects(:execute_with_status).with(
'PULP_SETTINGS=/etc/pulp/settings.py runuser -u pulp -- ' \
'pulpcore-manager rpm-datarepair 4007'
).returns([2, "CommandError: Unknown issue: '4007'"])

result = run_procedure(subject)
assert result.success?
Expand Down