Skip to content

Commit

Permalink
Fixes #34344 - Add support for halting
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Jan 28, 2022
1 parent 831bd3f commit 8cfa9df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 3 additions & 7 deletions app/controllers/foreman_tasks/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,14 @@ def resume
def unlock
task = find_dynflow_task
if task.paused?
task.state = :stopped
task.save!
render json: { statusText: 'OK' }
force_unlock(task)
else
render json: {}, status: :bad_request
end
end

def force_unlock
task = find_dynflow_task
task.state = :stopped
task.save!
def force_unlock(task = find_dynflow_task)
task.halt
render json: { statusText: 'OK' }
end

Expand Down
4 changes: 4 additions & 0 deletions app/models/foreman_tasks/task/dynflow_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ def self.model_name
superclass.model_name
end

def halt
::ForemanTasks.dynflow.world.halt(external_id)
end

private

def string_to_time(zone, time)
Expand Down
2 changes: 1 addition & 1 deletion foreman-tasks.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ same resource. It also optionally provides Dynflow infrastructure for using it f
s.test_files = `git ls-files test`.split("\n")
s.extra_rdoc_files = Dir['README*', 'LICENSE']

s.add_dependency "dynflow", '>= 1.6.0'
s.add_dependency "dynflow", '>= 1.7.0'
s.add_dependency "get_process_mem" # for memory polling
s.add_dependency "parse-cron", '~> 0.1.4'
s.add_dependency "sinatra" # for Dynflow web console
Expand Down

0 comments on commit 8cfa9df

Please sign in to comment.