summaryrefslogtreecommitdiff
path: root/lib/google_api
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-09-28 18:11:17 +0900
committerShinya Maeda <shinya@gitlab.com>2017-09-28 18:11:17 +0900
commitfabc359e77c39aea86f0eaa9f19b17b2a609dd99 (patch)
treee252491c27bd2ac6a2606cb7f89ac33ab1fa0254 /lib/google_api
parent058e595788118fb129d3003989a3728de9ae7e39 (diff)
downloadgitlab-ce-fabc359e77c39aea86f0eaa9f19b17b2a609dd99.tar.gz
Multithreading cluster creation is done with `reactive_cache`
Diffstat (limited to 'lib/google_api')
-rw-r--r--lib/google_api/cloud_platform/client.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index f0ca2c52aa7..61176e39464 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -40,7 +40,8 @@ module GoogleApi
begin
operation = service.create_cluster(project_id, zone, request_body)
rescue Google::Apis::ClientError, Google::Apis::AuthorizationError => e
- Rails.logger.error("#{self.class.name}: Could not create cluster #{cluster_name}: #{e}")
+ puts "#{self.class.name} - #{__callee__}: Could not create cluster #{cluster_name}: #{e}"
+ # TODO: Error
end
puts "#{self.class.name} - #{__callee__}: operation: #{operation.inspect}"
operation
@@ -51,23 +52,14 @@ module GoogleApi
service.authorization = access_token
operation = service.get_zone_operation(project_id, zone, operation_id)
+ puts "#{self.class.name} - #{__callee__}: operation: #{operation.inspect}"
operation
end
- def wait_operation_done(self_link)
- running = true
-
+ def parse_self_link(self_link)
ret = self_link.match(/projects\/(.*)\/zones\/(.*)\/operations\/(.*)/)
- project_id = ret[1]
- zone = ret[2]
- operation_id = ret[3]
- while running
- operation = projects_zones_operations(project_id, zone, operation_id)
- if operation.status != 'RUNNING'
- running = false
- end
- end
+ return ret[1], ret[2], ret[3] # project_id, zone, operation_id
end
end
end