Skip to content
Open
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
17 changes: 17 additions & 0 deletions definitions/procedures/pulpcore/rpm_datarepair.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Procedures::Pulpcore
class RpmDatarepair < ForemanMaintain::Procedure
include ForemanMaintain::Concerns::PulpCommon

metadata do
description 'Rename ContentArtifact relative_paths to match `{N-V-R.A.rpm}`'
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'))
end
end
end
end
1 change: 1 addition & 0 deletions definitions/scenarios/foreman_upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def compose
add_steps(
Procedures::RefreshFeatures,
Procedures::Service::Start,
Procedures::Pulpcore::RpmDatarepair,
Procedures::Crond::Start,
Procedures::SyncPlans::Enable,
Procedures::MaintenanceMode::DisableMaintenanceMode
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 @@ -120,6 +120,7 @@ def compose
add_steps(
Procedures::RefreshFeatures,
Procedures::Service::Start,
Procedures::Pulpcore::RpmDatarepair,
Procedures::Crond::Start,
Procedures::SyncPlans::Enable,
Procedures::MaintenanceMode::DisableMaintenanceMode,
Expand Down
2 changes: 1 addition & 1 deletion foreman_maintain.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ the Foreman/Satellite up and running."
s.add_dependency 'highline'

s.add_development_dependency 'bundler', '>= 1.17'
s.add_development_dependency 'minitest'
s.add_development_dependency 'minitest', '~> 5.0'
s.add_development_dependency 'minitest-reporters'
s.add_development_dependency 'minitest-stub-const'
s.add_development_dependency 'mocha'
Expand Down
6 changes: 3 additions & 3 deletions lib/foreman_maintain/cli/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def self.label_option
option '--label', 'label',
'Run only a specific check with a label. ' \
'(Use "list" command to see available labels)' do |label|
raise ArgumentError, 'value not specified' if label.nil? || label.empty?
raise ArgumentError, 'no value provided' if label.nil? || label.empty?
underscorize(label).to_sym
end
end
Expand All @@ -147,7 +147,7 @@ def self.tags_option
'Run only those with all specific set of tags. ' \
'(Use list-tags command to see available tags)',
:multivalued => true) do |tags|
raise ArgumentError, 'value not specified' if tags.nil? || tags.empty?
raise ArgumentError, 'no value provided' if tags.nil? || tags.empty?
tags.map { |tag| underscorize(tag).to_sym }
end
end
Expand All @@ -166,7 +166,7 @@ def self.interactive_option(opts = %w[assumeyes whitelist force plaintext])
if opts.include?('whitelist')
option(['-w', '--whitelist'], 'whitelist',
'Comma-separated list of labels of steps to be skipped') do |whitelist|
raise ArgumentError, 'value not specified' if whitelist.nil? || whitelist.empty?
raise ArgumentError, 'no value provided' if whitelist.nil? || whitelist.empty?
whitelist.split(',').map(&:strip)
end
end
Expand Down
21 changes: 21 additions & 0 deletions test/definitions/procedures/pulpcore/rpm_datarepair_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'test_helper'

describe Procedures::Pulpcore::RpmDatarepair do
include DefinitionsTestHelper

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

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

subject.expects(:execute!).with(
'PULP_SETTINGS=/etc/pulp/settings.py runuser -u pulp -- ' \
'pulpcore-manager rpm-datarepair 4073'
).once

result = run_procedure(subject)
assert result.success?
end
end
1 change: 1 addition & 0 deletions test/definitions/scenarios/satellite_upgrade_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
scenario,
Procedures::RefreshFeatures,
Procedures::Service::Start,
Procedures::Pulpcore::RpmDatarepair,
Procedures::Crond::Start,
Procedures::SyncPlans::Enable,
Procedures::MaintenanceMode::DisableMaintenanceMode,
Expand Down
4 changes: 2 additions & 2 deletions test/lib/cli/health_command_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ module ForemanMaintain

it 'raises errors on empty arguments' do
assert_cmd <<~OUTPUT, %w[--label]
ERROR: option '--label': value not specified
ERROR: option '--label': no value provided

See: 'foreman-maintain health check --help'
OUTPUT

assert_cmd <<~OUTPUT, %w[--tags]
ERROR: option '--tags': value not specified
ERROR: option '--tags': no value provided

See: 'foreman-maintain health check --help'
OUTPUT
Expand Down
Loading