debian-mirror-gitlab/app/services/ci/runners/update_runner_service.rb
2022-10-11 01:57:18 +05:30

24 lines
510 B
Ruby

# frozen_string_literal: true
module Ci
module Runners
class UpdateRunnerService
attr_reader :runner
def initialize(runner)
@runner = runner
end
def execute(params)
params[:active] = !params.delete(:paused) if params.include?(:paused)
if runner.update(params)
runner.tick_runner_queue
ServiceResponse.success
else
ServiceResponse.error(message: runner.errors.full_messages)
end
end
end
end
end