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
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2019-05-30 14:05:05 +0300
committerJames Fargher <proglottis@gmail.com>2019-05-30 14:05:05 +0300
commit3a5977bad4dfe5aa9cf216e2f50eb6f711c2f167 (patch)
tree1a4e6bb8f5d95ea1d24ba3b8b34ff808b21ad19a
parent4498f74f8dfd607941516794ae2a06d2c7e375c1 (diff)
Remove DeploymentService edge cases
-rw-r--r--app/models/deployment.rb6
-rw-r--r--app/services/prometheus/adapter_service.rb7
2 files changed, 4 insertions, 9 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 92c7311014a..f5fdf285522 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -85,11 +85,7 @@ class Deployment < ApplicationRecord
end
def cluster
- platform = project.deployment_platform(environment: environment.name)
-
- if platform.present? && platform.respond_to?(:cluster)
- platform.cluster
- end
+ project.deployment_platform(environment: environment.name)&.cluster
end
def execute_hooks
diff --git a/app/services/prometheus/adapter_service.rb b/app/services/prometheus/adapter_service.rb
index 3be958e1613..2bdd47caf7c 100644
--- a/app/services/prometheus/adapter_service.rb
+++ b/app/services/prometheus/adapter_service.rb
@@ -27,12 +27,11 @@ module Prometheus
end
def cluster_prometheus_adapter
- return unless deployment_platform.respond_to?(:cluster)
+ application = deployment_platform&.cluster&.application_prometheus
- cluster = deployment_platform.cluster
- return unless cluster.application_prometheus&.available?
+ return unless application&.available?
- cluster.application_prometheus
+ application
end
end
end