diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-31 11:47:48 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-31 11:47:48 +0300 |
commit | 6a65e2f5f94781a69f3f7fb329483ead6bc81fd9 (patch) | |
tree | 166567d712cfb4337058ca65d6dbd71cb299aa13 /app/services/clusters | |
parent | 944149ec1602e72215283a77ab0b72dabd7ce8b8 (diff) |
specs for controller. Improved validation
Diffstat (limited to 'app/services/clusters')
-rw-r--r-- | app/services/clusters/create_service.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index 3f458e25c14..94b889895ba 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -28,10 +28,10 @@ module Clusters def cluster_params return @cluster_params if defined?(@cluster_params) - params[:provider_gcp_attributes][:machine_type] ||= - GoogleApi::CloudPlatform::Client::DEFAULT_MACHINE_TYPE - - params[:provider_gcp_attributes][:access_token] ||= access_token + params[:provider_gcp_attributes].try do |h| + h[:machine_type] ||= GoogleApi::CloudPlatform::Client::DEFAULT_MACHINE_TYPE + h[:access_token] ||= access_token + end @cluster_params = params.merge(user: current_user) end |