diff options
Diffstat (limited to 'app/services/ci/runners/assign_runner_service.rb')
-rw-r--r-- | app/services/ci/runners/assign_runner_service.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/services/ci/runners/assign_runner_service.rb b/app/services/ci/runners/assign_runner_service.rb index 886cd3a4e44..290f945cc72 100644 --- a/app/services/ci/runners/assign_runner_service.rb +++ b/app/services/ci/runners/assign_runner_service.rb @@ -13,9 +13,15 @@ module Ci end def execute - return false unless @user.present? && @user.can?(:assign_runner, @runner) + unless @user.present? && @user.can?(:assign_runner, @runner) + return ServiceResponse.error(message: 'user not allowed to assign runner', http_status: :forbidden) + end - @runner.assign_to(@project, @user) + if @runner.assign_to(@project, @user) + ServiceResponse.success + else + ServiceResponse.error(message: 'failed to assign runner') + end end private |