From c1a37c6032c3a53a79027c25c33660ad018359e4 Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat@godfat.org>
Date: Wed, 8 Feb 2017 22:29:44 +0800
Subject: [PATCH] Use UpdateRunnerService to update runner in API:

TODO: Add tests to make sure controllers and API
would tick the queue.
---
 lib/api/runners.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 4816b5ed1b7..4fbd4096533 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -60,8 +60,9 @@ module API
       put ':id' do
         runner = get_runner(params.delete(:id))
         authenticate_update_runner!(runner)
+        update_service = Ci::UpdateRunnerService.new(runner)
 
-        if runner.update(declared_params(include_missing: false))
+        if update_service.update(declared_params(include_missing: false))
           present runner, with: Entities::RunnerDetails, current_user: current_user
         else
           render_validation_error!(runner)
-- 
GitLab