diff --git a/lib/fog/google/examples/backend_services.rb b/lib/fog/google/examples/backend_services.rb index 8f69c886a..4c9ad81fe 100644 --- a/lib/fog/google/examples/backend_services.rb +++ b/lib/fog/google/examples/backend_services.rb @@ -2,24 +2,21 @@ require 'rubygems' require 'fog' def test - connection = Fog::Compute.new({ :provider => "google", - :google_project => "", - :google_client_email => "", - :google_key_location => "" - }) -health = connection.http_health_checks.create({ - :name => 'test-checks' + connection = Fog::Compute.new({:provider => "google"}) + health = connection.http_health_checks.create({ + :name => 'test-checks' }) health.wait_for { health.ready? } - backend= connection.backend_services.create({ - :name => 'backend-test', - :health_checks => [health.self_link], - :port => 8080, - :timeout_sec => 40, - :backends => [{'group' => 'resource_view self_link'}] - }) -puts connection.backend_services.all -backend= connection.backend_services.get('backend-test') -backend.get_health + backend= connection.backend_services.create({ + :name => 'backend-test', + :health_checks => [health.self_link], + :port => 8080, + :timeout_sec => 40, + :backends => [{'group' => 'resource_view self_link'}] + }) + puts connection.backend_services.all + backend= connection.backend_services.get('backend-test') + backend.get_health end + test diff --git a/lib/fog/google/models/compute/backend_service.rb b/lib/fog/google/models/compute/backend_service.rb index 2202fddf6..ea3efb372 100644 --- a/lib/fog/google/models/compute/backend_service.rb +++ b/lib/fog/google/models/compute/backend_service.rb @@ -38,17 +38,18 @@ module Fog end def destroy(async=false) - requires :name - operation = service.delete_backend_service(name) - unless async - operation.wait_for { ready? } - end - operation + requires :name + operation = service.delete_backend_service(name) + unless async + operation.wait_for { ready? } + end + operation end def get_health service.get_backend_service_health self end + def ready? begin service.get_backend_service(self.name) @@ -61,11 +62,12 @@ module Fog def reload requires :name - return unless data = begin - collection.get(name) - rescue Excon::Errors::SocketError - nil - end + return unless data = + begin + collection.get(name) + rescue Excon::Errors::SocketError + nil + end new_attributes = data.attributes merge_attributes(new_attributes) @@ -76,5 +78,3 @@ module Fog end end end - - diff --git a/lib/fog/google/requests/compute/delete_backend_service.rb b/lib/fog/google/requests/compute/delete_backend_service.rb index c80bed6c2..85ad74e5a 100644 --- a/lib/fog/google/requests/compute/delete_backend_service.rb +++ b/lib/fog/google/requests/compute/delete_backend_service.rb @@ -3,7 +3,7 @@ module Fog class Google class Mock def delete_backend_service(backend_service_name) - Fog::Mock.not_implemented + Fog::Mock.not_implemented end end diff --git a/lib/fog/google/requests/compute/get_backend_service_health.rb b/lib/fog/google/requests/compute/get_backend_service_health.rb index e70ea3ea8..0c80cb9d6 100644 --- a/lib/fog/google/requests/compute/get_backend_service_health.rb +++ b/lib/fog/google/requests/compute/get_backend_service_health.rb @@ -14,12 +14,12 @@ module Fog 'project' => @project, 'backendService' => backend_service.name } - health_results = backend_service.backends.map do |backend| - body = { 'group' => backend['group'] } + health_results = backend_service.backends.map do |backend| + body = { 'group' => backend['group'] } resp = build_response(build_result(api_method, parameters, body_object= body)) - [backend['group'], resp.data[:body]['healthStatus']] - end - Hash[health_results] + [backend['group'], resp.data[:body]['healthStatus']] + end + Hash[health_results] end end end diff --git a/lib/fog/google/requests/compute/insert_backend_service.rb b/lib/fog/google/requests/compute/insert_backend_service.rb index dce1e7ba2..bca0a73de 100644 --- a/lib/fog/google/requests/compute/insert_backend_service.rb +++ b/lib/fog/google/requests/compute/insert_backend_service.rb @@ -3,7 +3,7 @@ module Fog class Google class Mock def insert_backend_service(backend_service_name) - Fog::Mock.not_implemented + Fog::Mock.not_implemented end end @@ -23,4 +23,3 @@ module Fog end end end - diff --git a/lib/fog/google/requests/compute/list_backend_services.rb b/lib/fog/google/requests/compute/list_backend_services.rb index 4ddd69711..52d571e81 100644 --- a/lib/fog/google/requests/compute/list_backend_services.rb +++ b/lib/fog/google/requests/compute/list_backend_services.rb @@ -12,7 +12,6 @@ module Fog api_method = @compute.backend_services.list parameters = { 'project' => @project, - } result = self.build_result(api_method, parameters)