Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-06-14 18:05:33 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-06-14 18:05:33 +0300
commit6c500034f4e626f28fa0a47534c24f7181131b43 (patch)
tree9269501787f26868f69a496eb9694104e6ae3d17 /lib/api/runners.rb
parentfd285f71d8da46e76719a1055f168cd0b7e45094 (diff)
parentf74f42386029077d0f12ac407fc6ee39aaeeaf53 (diff)
Merge branch 'prefer-assign_to' into feature/runner-lock-on-project
* prefer-assign_to: Give 409 Conflict whenever the runner was already enabled We're checking return value rather than rescuing exceptions Prefer Runner#assign_to instead of creating directly
Diffstat (limited to 'lib/api/runners.rb')
-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 3ae228d61d8..2c2610fc2e7 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)
- Ci::RunnerProject.create(runner: runner, project: 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