summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-06-14 22:17:01 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-06-14 22:25:11 +0800
commitf74f42386029077d0f12ac407fc6ee39aaeeaf53 (patch)
tree29004014c599c19521d26f401202d84e34649a83 /lib
parent1b03c5807fab6d2122e5a590cebfb2e7978a6659 (diff)
downloadgitlab-ce-prefer-assign_to.tar.gz
Give 409 Conflict whenever the runner was already enabledprefer-assign_to
Diffstat (limited to 'lib')
-rw-r--r--lib/api/runners.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index be92355d9a6..7bea4386e03 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -96,9 +96,12 @@ module API
runner = get_runner(params[:runner_id])
authenticate_enable_runner!(runner)
- runner.assign_to(user_project)
- present runner, with: Entities::Runner
+ if runner.assign_to(user_project)
+ present runner, with: Entities::Runner
+ else
+ conflict!("Runner was already enabled for this project")
+ end
end
# Disable project's runner