diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-30 15:55:18 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-30 15:55:18 +0300 |
commit | d6744d98384192799c9b3a97ad0eaf69cb4d25ee (patch) | |
tree | 68cb8a8002448165c350c6556175ba57befabe3a /app | |
parent | 478e59fe8d82b99800a2613aa4d153bf692fbd6b (diff) |
specs for services. Improved details.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/clusters/cluster.rb | 2 | ||||
-rw-r--r-- | app/models/clusters/platforms/kubernetes.rb | 3 | ||||
-rw-r--r-- | app/services/clusters/gcp/finalize_creation_service.rb | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 4260fadb46d..7af56adb613 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -13,7 +13,7 @@ module Clusters has_one :platform_kubernetes, class_name: 'Clusters::Platforms::Kubernetes' accepts_nested_attributes_for :provider_gcp - accepts_nested_attributes_for :platform_kubernetes + accepts_nested_attributes_for :platform_kubernetes, update_only: true validates :name, cluster_name: true validate :restrict_modification, on: :update diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index b20b00ff51b..1a4e293be65 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -111,9 +111,6 @@ module Clusters kubeclient = build_kubeclient! kubeclient.get_secrets.as_json - rescue KubeException => err - raise err unless err.error_code == 404 - [] end # Returns a hash of all pods in the namespace diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 9f257bd0e9a..d379870924a 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -14,9 +14,11 @@ module Clusters provider.make_created! end rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e - cluster.make_errored!("Failed to request to CloudPlatform; #{e.message}") + provider.make_errored!("Failed to request to CloudPlatform; #{e.message}") + rescue KubeException => e + provider.make_errored!("Failed to request to Kubernetes; #{e.message}") rescue ActiveRecord::RecordInvalid => e - cluster.make_errored!("Failed to configure GKE Cluster: #{e.message}") + provider.make_errored!("Failed to configure GKE Cluster: #{e.message}") end private @@ -41,6 +43,8 @@ module Clusters return Base64.decode64(token_base64) if token_base64 end end + + nil end def gke_cluster |