summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-03-29 22:08:13 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-03-29 22:08:13 +0200
commitf6fa84298282c78229e4028655cb87011372e2b2 (patch)
treed35b44cc029a56d845b43ee11b1238c804beb63b /app
parente36b203fa44b3cfbf52806b80c4bb661f9d7ddd1 (diff)
downloadgitlab-ce-f6fa84298282c78229e4028655cb87011372e2b2.tar.gz
Extract installed cluster application scope to concern
Diffstat (limited to 'app')
-rw-r--r--app/models/clusters/applications/helm.rb2
-rw-r--r--app/models/clusters/applications/ingress.rb2
-rw-r--r--app/models/clusters/applications/prometheus.rb2
-rw-r--r--app/models/clusters/applications/runner.rb2
-rw-r--r--app/models/clusters/concerns/application_status.rb2
5 files changed, 2 insertions, 8 deletions
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb
index f7dfae56df6..58de3448577 100644
--- a/app/models/clusters/applications/helm.rb
+++ b/app/models/clusters/applications/helm.rb
@@ -8,8 +8,6 @@ module Clusters
default_value_for :version, Gitlab::Kubernetes::Helm::HELM_VERSION
- scope :installed, -> { where(status: ::Clusters::Applications::Helm.state_machines[:status].states[:installed].value) }
-
def set_initial_status
return unless not_installable?
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb
index 8cd88e8aeaf..27fc3b85465 100644
--- a/app/models/clusters/applications/ingress.rb
+++ b/app/models/clusters/applications/ingress.rb
@@ -11,8 +11,6 @@ module Clusters
default_value_for :ingress_type, :nginx
default_value_for :version, :nginx
- scope :installed, -> { where(status: ::Clusters::Applications::Ingress.state_machines[:status].states[:installed].value) }
-
enum ingress_type: {
nginx: 1
}
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb
index 2ae3e006047..7b25d8c4089 100644
--- a/app/models/clusters/applications/prometheus.rb
+++ b/app/models/clusters/applications/prometheus.rb
@@ -13,8 +13,6 @@ module Clusters
default_value_for :version, VERSION
- scope :installed, -> { where(status: ::Clusters::Applications::Prometheus.state_machines[:status].states[:installed].value) }
-
state_machine :status do
after_transition any => [:installed] do |application|
application.cluster.projects.each do |project|
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb
index 6dc51d1baa4..16efe90fa27 100644
--- a/app/models/clusters/applications/runner.rb
+++ b/app/models/clusters/applications/runner.rb
@@ -14,8 +14,6 @@ module Clusters
default_value_for :version, VERSION
- scope :installed, -> { where(status: ::Clusters::Applications::Runner.state_machines[:status].states[:installed].value) }
-
def chart
"#{name}/gitlab-runner"
end
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb
index 7b7c8eac773..8f3eb75bfa9 100644
--- a/app/models/clusters/concerns/application_status.rb
+++ b/app/models/clusters/concerns/application_status.rb
@@ -4,6 +4,8 @@ module Clusters
extend ActiveSupport::Concern
included do
+ scope :installed, -> { where(status: self.state_machines[:status].states[:installed].value) }
+
state_machine :status, initial: :not_installable do
state :not_installable, value: -2
state :errored, value: -1