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:
authorDennis Tang <dtang@gitlab.com>2018-05-26 02:36:56 +0300
committerDennis Tang <dtang@gitlab.com>2018-05-26 02:36:56 +0300
commit70c65e827b7974529409e5f9af5c1d094c08ed19 (patch)
treea4d885806116e72717453ff4134f7792fbe37307 /app/controllers/projects/clusters_controller.rb
parent2532dc740f93efada473296716a3b903427963a4 (diff)
fix case where token may expire
Diffstat (limited to 'app/controllers/projects/clusters_controller.rb')
-rw-r--r--app/controllers/projects/clusters_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb
index c44949f2125..74e1a78360d 100644
--- a/app/controllers/projects/clusters_controller.rb
+++ b/app/controllers/projects/clusters_controller.rb
@@ -171,8 +171,7 @@ class Projects::ClustersController < Projects::ApplicationController
end
def new_cluster
- if GoogleApi::CloudPlatform::Client.new(token_in_session, nil)
- .validate_token(expires_at_in_session)
+ if valid_gcp_token
@new_cluster = ::Clusters::Cluster.new.tap do |cluster|
cluster.build_provider_gcp
end
@@ -185,6 +184,11 @@ class Projects::ClustersController < Projects::ApplicationController
end
end
+ def valid_gcp_token
+ @valid_gcp_token = GoogleApi::CloudPlatform::Client.new(token_in_session, nil)
+ .validate_token(expires_at_in_session)
+ end
+
def token_in_session
@token_in_session ||=
session[GoogleApi::CloudPlatform::Client.session_key_for_token]