From 9eeca2db6db51e1d7b121a0efdfe14b517dea4b6 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Tue, 12 Feb 2019 16:13:59 +1300 Subject: Move common method to application concern This could be potentially useful to all cluster applications. Address followup issue https://gitlab.com/gitlab-org/gitlab-ce/issues/56524 --- app/models/clusters/applications/prometheus.rb | 5 ----- app/models/clusters/concerns/application_status.rb | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index 52c440ffb2f..fa7ce363531 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -6,7 +6,6 @@ module Clusters include PrometheusAdapter VERSION = '6.7.3' - READY_STATUS = [:installed, :updating, :updated, :update_errored].freeze self.table_name = 'clusters_applications_prometheus' @@ -25,10 +24,6 @@ module Clusters end end - def ready? - READY_STATUS.include?(status_name) - end - def chart 'stable/prometheus' end diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index 5c0164831bc..9ecd7229604 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -80,6 +80,10 @@ module Clusters installed? || updated? end + def ready? + installed? || updating? || updated? || update_errored? + end + def update_in_progress? updating? end -- cgit v1.2.3 From 13bb704d50cc885935bc7b0f850d47c1ace5cdd7 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Fri, 15 Feb 2019 12:43:44 +1300 Subject: Remove #ready? method in favor of #available? Given https://github.com/helm/helm/issues/3338, I think that we should exclude applications that are :update_errored, :updating as well. --- app/models/clusters/concerns/application_status.rb | 4 ---- app/services/prometheus/adapter_service.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'app') diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index 9ecd7229604..5c0164831bc 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -80,10 +80,6 @@ module Clusters installed? || updated? end - def ready? - installed? || updating? || updated? || update_errored? - end - def update_in_progress? updating? end diff --git a/app/services/prometheus/adapter_service.rb b/app/services/prometheus/adapter_service.rb index a791845ba20..3be958e1613 100644 --- a/app/services/prometheus/adapter_service.rb +++ b/app/services/prometheus/adapter_service.rb @@ -30,7 +30,7 @@ module Prometheus return unless deployment_platform.respond_to?(:cluster) cluster = deployment_platform.cluster - return unless cluster.application_prometheus&.ready? + return unless cluster.application_prometheus&.available? cluster.application_prometheus end -- cgit v1.2.3