1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Whitespace cleanup of #3069.

This commit is contained in:
Nat Welch 2014-07-25 08:50:32 +00:00
parent e62c5407e1
commit ed7bc035b7
6 changed files with 34 additions and 39 deletions

View file

@ -2,24 +2,21 @@ require 'rubygems'
require 'fog' require 'fog'
def test def test
connection = Fog::Compute.new({ :provider => "google", connection = Fog::Compute.new({:provider => "google"})
:google_project => "", health = connection.http_health_checks.create({
:google_client_email => "", :name => 'test-checks'
:google_key_location => ""
})
health = connection.http_health_checks.create({
:name => 'test-checks'
}) })
health.wait_for { health.ready? } health.wait_for { health.ready? }
backend= connection.backend_services.create({ backend= connection.backend_services.create({
:name => 'backend-test', :name => 'backend-test',
:health_checks => [health.self_link], :health_checks => [health.self_link],
:port => 8080, :port => 8080,
:timeout_sec => 40, :timeout_sec => 40,
:backends => [{'group' => 'resource_view self_link'}] :backends => [{'group' => 'resource_view self_link'}]
}) })
puts connection.backend_services.all puts connection.backend_services.all
backend= connection.backend_services.get('backend-test') backend= connection.backend_services.get('backend-test')
backend.get_health backend.get_health
end end
test test

View file

@ -38,17 +38,18 @@ module Fog
end end
def destroy(async=false) def destroy(async=false)
requires :name requires :name
operation = service.delete_backend_service(name) operation = service.delete_backend_service(name)
unless async unless async
operation.wait_for { ready? } operation.wait_for { ready? }
end end
operation operation
end end
def get_health def get_health
service.get_backend_service_health self service.get_backend_service_health self
end end
def ready? def ready?
begin begin
service.get_backend_service(self.name) service.get_backend_service(self.name)
@ -61,11 +62,12 @@ module Fog
def reload def reload
requires :name requires :name
return unless data = begin return unless data =
collection.get(name) begin
rescue Excon::Errors::SocketError collection.get(name)
nil rescue Excon::Errors::SocketError
end nil
end
new_attributes = data.attributes new_attributes = data.attributes
merge_attributes(new_attributes) merge_attributes(new_attributes)
@ -76,5 +78,3 @@ module Fog
end end
end end
end end

View file

@ -3,7 +3,7 @@ module Fog
class Google class Google
class Mock class Mock
def delete_backend_service(backend_service_name) def delete_backend_service(backend_service_name)
Fog::Mock.not_implemented Fog::Mock.not_implemented
end end
end end

View file

@ -14,12 +14,12 @@ module Fog
'project' => @project, 'project' => @project,
'backendService' => backend_service.name 'backendService' => backend_service.name
} }
health_results = backend_service.backends.map do |backend| health_results = backend_service.backends.map do |backend|
body = { 'group' => backend['group'] } body = { 'group' => backend['group'] }
resp = build_response(build_result(api_method, parameters, body_object= body)) resp = build_response(build_result(api_method, parameters, body_object= body))
[backend['group'], resp.data[:body]['healthStatus']] [backend['group'], resp.data[:body]['healthStatus']]
end end
Hash[health_results] Hash[health_results]
end end
end end
end end

View file

@ -3,7 +3,7 @@ module Fog
class Google class Google
class Mock class Mock
def insert_backend_service(backend_service_name) def insert_backend_service(backend_service_name)
Fog::Mock.not_implemented Fog::Mock.not_implemented
end end
end end
@ -23,4 +23,3 @@ module Fog
end end
end end
end end

View file

@ -12,7 +12,6 @@ module Fog
api_method = @compute.backend_services.list api_method = @compute.backend_services.list
parameters = { parameters = {
'project' => @project, 'project' => @project,
} }
result = self.build_result(api_method, parameters) result = self.build_result(api_method, parameters)