diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-08-02 22:45:43 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-02 22:45:43 +0300 |
commit | 08188285cbfe2f0791d8cb913b7d19b216ff1c85 (patch) | |
tree | 83f33a5c6f83da11cd34c8347be97ff25671d80e /app/models/clusters | |
parent | e14265d50d80e96db694f66d6ea3a12b1fdcf943 (diff) |
All Kubectl command should return array by default
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/applications/knative.rb | 10 | ||||
-rw-r--r-- | app/models/clusters/applications/prometheus.rb | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb index 96f526e8a36..5eae23659ae 100644 --- a/app/models/clusters/applications/knative.rb +++ b/app/models/clusters/applications/knative.rb @@ -84,7 +84,7 @@ module Clusters private def delete_knative_services_and_metrics - delete_knative_services + delete_knative_istio_metrics.to_a + delete_knative_services + delete_knative_istio_metrics end def delete_knative_services @@ -117,11 +117,15 @@ module Clusters end def install_knative_metrics - ["kubectl apply -f #{METRICS_CONFIG}"] if cluster.application_prometheus_available? + return [] unless cluster.application_prometheus_available? + + ["kubectl apply -f #{METRICS_CONFIG}"] end def delete_knative_istio_metrics - ["kubectl delete --ignore-not-found -f #{METRICS_CONFIG}"] if cluster.application_prometheus_available? + return [] unless cluster.application_prometheus_available? + + ["kubectl delete --ignore-not-found -f #{METRICS_CONFIG}"] end def verify_cluster? diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index f5375d29f3a..5eb535cab58 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -64,7 +64,7 @@ module Clusters name: name, rbac: cluster.platform_kubernetes_rbac?, files: files, - predelete: delete_knative_istio_metrics.to_a + predelete: delete_knative_istio_metrics ) end @@ -104,11 +104,15 @@ module Clusters end def install_knative_metrics - ["kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] if cluster.application_knative_available? + return [] unless cluster.application_knative_available? + + ["kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] end def delete_knative_istio_metrics - ["kubectl delete -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] if cluster.application_knative_available? + return [] unless cluster.application_knative_available? + + ["kubectl delete -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] end end end |