Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Jun 14, 2024
1 parent c337b27 commit 73b53e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
14 changes: 5 additions & 9 deletions definitions/checks/foreman_tasks/not_running.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ class NotRunning < ForemanMaintain::Check
'Wait for tasks to finish or fail directly',
:required => false,
:default => true
param :investigate_tasks,
'Allow task investigation',
:required => false,
:default => true
end

def run
Expand All @@ -39,11 +35,11 @@ def calculate_next_steps
steps = []
if @wait_for_tasks
steps << Procedures::ForemanTasks::FetchTasksStatus.new(:state => 'running')
end
if @investigate_tasks
steps << Procedures::ForemanTasks::UiInvestigate.new(
'search_query' => search_query_for_running_tasks
)
unless assumeyes?
steps << Procedures::ForemanTasks::UiInvestigate.new(
'search_query' => search_query_for_running_tasks
)
end
end
steps
end
Expand Down
3 changes: 1 addition & 2 deletions definitions/scenarios/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class Backup < BackupBase

def compose
check_valid_strategy
add_step(Checks::ForemanTasks::NotRunning.new(:wait_for_tasks => wait_for_tasks,
:investigate_tasks => false))
add_step(Checks::ForemanTasks::NotRunning.new(:wait_for_tasks => wait_for_tasks))
add_step(Checks::Pulpcore::NoRunningTasks.new(:wait_for_tasks => wait_for_tasks))
safety_confirmation
add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
Expand Down
4 changes: 2 additions & 2 deletions test/definitions/checks/foreman_tasks/not_running_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
end
end

context 'with wait_for_tasks=>false and investigate_tasks=>false' do
context 'with wait_for_tasks=>false' do
subject do
Checks::ForemanTasks::NotRunning.new(:wait_for_tasks => false, :investigate_tasks => false)
Checks::ForemanTasks::NotRunning.new(:wait_for_tasks => false)
end

it 'passes when not active tasks are present' do
Expand Down

0 comments on commit 73b53e6

Please sign in to comment.