From cf996685bebd9ce33980b3f7b060609bb9583649 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 23 May 2018 15:49:39 +0300 Subject: Refactor code around scheduling cluster installations Signed-off-by: Dmitriy Zaporozhets --- .../applications/schedule_installation_service.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'app/services') diff --git a/app/services/clusters/applications/schedule_installation_service.rb b/app/services/clusters/applications/schedule_installation_service.rb index eb8caa68ef7..9c5461e85e1 100644 --- a/app/services/clusters/applications/schedule_installation_service.rb +++ b/app/services/clusters/applications/schedule_installation_service.rb @@ -1,21 +1,10 @@ module Clusters module Applications class ScheduleInstallationService < ::BaseService - def execute - application_class.find_or_create_by!(cluster: cluster).try do |application| - application.make_scheduled! - ClusterInstallAppWorker.perform_async(application.name, application.id) - end - end - - private - - def application_class - params[:application_class] - end + def execute(application) + application.make_scheduled! - def cluster - params[:cluster] + ClusterInstallAppWorker.perform_async(application.name, application.id) end end end -- cgit v1.2.1