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
path: root/app
diff options
context:
space:
mode:
authorJoão Cunha <j.a.cunha@gmail.com>2019-02-26 19:44:31 +0300
committerSean McGivern <sean@gitlab.com>2019-02-26 19:44:31 +0300
commit4c974f50f6e85165f9750cc42760e4a2fbd81e6f (patch)
treea856956ba1072007ba5ddce36b10ef2b8e808a63 /app
parentb7a3c8f6404ba2890409e0e79697fa34354cf46e (diff)
Get rid of ScheduleInstallationService
- deletes schedule_installation_service.rb - moves schedule_installation_service.rb logic to create_service.rb - moves specs as well Removes code duplication Remove unecessary spec block Abide review suggestions Test installable applications which are not associated to a cluster Fix a typo Removes duplciated expectation Reuse variable instead of redefining Remove method in favor of a local scoped lambda Improve 'failing service' shared examples Test the increase of status count Remove duplicated test Enable fronzen literal
Diffstat (limited to 'app')
-rw-r--r--app/services/clusters/applications/create_service.rb6
-rw-r--r--app/services/clusters/applications/schedule_installation_service.rb31
2 files changed, 4 insertions, 33 deletions
diff --git a/app/services/clusters/applications/create_service.rb b/app/services/clusters/applications/create_service.rb
index 92c2c1b9834..12f8c849d41 100644
--- a/app/services/clusters/applications/create_service.rb
+++ b/app/services/clusters/applications/create_service.rb
@@ -27,9 +27,11 @@ module Clusters
application.oauth_application = create_oauth_application(application, request)
end
- application.save!
+ worker = application.updateable? ? ClusterUpgradeAppWorker : ClusterInstallAppWorker
- Clusters::Applications::ScheduleInstallationService.new(application).execute
+ application.make_scheduled!
+
+ worker.perform_async(application.name, application.id)
end
end
diff --git a/app/services/clusters/applications/schedule_installation_service.rb b/app/services/clusters/applications/schedule_installation_service.rb
deleted file mode 100644
index 15c93f1e79b..00000000000
--- a/app/services/clusters/applications/schedule_installation_service.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-module Clusters
- module Applications
- class ScheduleInstallationService
- attr_reader :application
-
- def initialize(application)
- @application = application
- end
-
- def execute
- application.updateable? ? schedule_upgrade : schedule_install
- end
-
- private
-
- def schedule_upgrade
- application.make_scheduled!
-
- ClusterUpgradeAppWorker.perform_async(application.name, application.id)
- end
-
- def schedule_install
- application.make_scheduled!
-
- ClusterInstallAppWorker.perform_async(application.name, application.id)
- end
- end
- end
-end