summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-23 15:49:39 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-05-24 12:31:36 +0300
commitcf996685bebd9ce33980b3f7b060609bb9583649 (patch)
treebe3bebfd2260f592c468cb7afa6be6109747f0e8 /app/controllers
parentcf7f3606d3bca3dfb481323aaa4f3dc50ca1a089 (diff)
downloadgitlab-ce-cf996685bebd9ce33980b3f7b060609bb9583649.tar.gz
Refactor code around scheduling cluster installationsdz-refactor-cluster-apps-schedule
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/clusters/applications_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb
index 90c7fa62216..35885543622 100644
--- a/app/controllers/projects/clusters/applications_controller.rb
+++ b/app/controllers/projects/clusters/applications_controller.rb
@@ -5,9 +5,10 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll
before_action :authorize_create_cluster!, only: [:create]
def create
- Clusters::Applications::ScheduleInstallationService.new(project, current_user,
- application_class: @application_class,
- cluster: @cluster).execute
+ application = @application_class.find_or_create_by!(cluster: @cluster)
+
+ Clusters::Applications::ScheduleInstallationService.new(project, current_user).execute(application)
+
head :no_content
rescue StandardError
head :bad_request