diff --git a/lib/fog/compute/models/aws/server.rb b/lib/fog/compute/models/aws/server.rb index 682643d8b..19e06a1fc 100644 --- a/lib/fog/compute/models/aws/server.rb +++ b/lib/fog/compute/models/aws/server.rb @@ -5,6 +5,8 @@ module Fog class Compute class Server < Fog::Model + include Fog::Deprecation + deprecate :ip_address, :public_ip_address identity :id, :aliases => 'instanceId' @@ -18,7 +20,6 @@ module Fog attribute :flavor_id, :aliases => 'instanceType' attribute :image_id, :aliases => 'imageId' attr_accessor :instance_initiated_shutdown_behavior - attribute :ip_address, :aliases => 'ipAddress' attribute :kernel_id, :aliases => 'kernelId' attribute :key_name, :aliases => 'keyName' attribute :created_at, :aliases => 'launchTime' @@ -26,6 +27,7 @@ module Fog attribute :product_codes, :aliases => 'productCodes' attribute :private_dns_name, :aliases => 'privateDnsName' attribute :private_ip_address, :aliases => 'privateIpAddress' + attribute :public_ip_address, :aliases => 'ipAddress' attribute :ramdisk_id, :aliases => 'ramdiskId' attribute :reason attribute :root_device_name, :aliases => 'rootDeviceName' diff --git a/lib/fog/compute/models/bluebox/server.rb b/lib/fog/compute/models/bluebox/server.rb index 2af7b99d7..1bd63907d 100644 --- a/lib/fog/compute/models/bluebox/server.rb +++ b/lib/fog/compute/models/bluebox/server.rb @@ -45,6 +45,10 @@ module Fog connection.images.get(image_id) end + def private_ip_address + nil + end + def private_key_path @private_key_path ||= Fog.credentials[:private_key_path] @private_key_path &&= File.expand_path(@private_key_path) @@ -54,6 +58,10 @@ module Fog @private_key ||= private_key_path && File.read(private_key_path) end + def public_ip_address + ips.first + end + def public_key_path @public_key_path ||= Fog.credentials[:public_key_path] @public_key_path &&= File.expand_path(@public_key_path) diff --git a/lib/fog/compute/models/brightbox/server.rb b/lib/fog/compute/models/brightbox/server.rb index 4380bee6b..1cc2fe130 100644 --- a/lib/fog/compute/models/brightbox/server.rb +++ b/lib/fog/compute/models/brightbox/server.rb @@ -71,6 +71,14 @@ module Fog connection.images.get(image_id) end + def private_ip_address + nil + end + + def public_ip_address + cloud_ips.first + end + def ready? status == 'active' end diff --git a/lib/fog/compute/models/go_grid/server.rb b/lib/fog/compute/models/go_grid/server.rb index d367fdf2e..d38c8325a 100644 --- a/lib/fog/compute/models/go_grid/server.rb +++ b/lib/fog/compute/models/go_grid/server.rb @@ -7,12 +7,14 @@ module Fog class BlockInstantiationError < StandardError; end class Server < Fog::Model + include Fog::Deprecation + deprecate(:ip, :public_ip_address) identity :id attribute :name attribute :image_id # id or name - attribute :ip + attribute :public_ip_address, :aliases => 'ip' attribute :memory # server.ram attribute :state attribute :description # Optional @@ -33,6 +35,10 @@ module Fog connection.grid_image_get(:image => image_id) end + def private_ip_address + nil + end + def ready? @state && @state["name"] == 'On' end diff --git a/lib/fog/compute/models/rackspace/server.rb b/lib/fog/compute/models/rackspace/server.rb index 971305974..e6295362c 100644 --- a/lib/fog/compute/models/rackspace/server.rb +++ b/lib/fog/compute/models/rackspace/server.rb @@ -47,6 +47,10 @@ module Fog connection.images(:server => self) end + def private_ip_address + nil + end + def private_key_path @private_key_path ||= Fog.credentials[:private_key_path] @private_key_path &&= File.expand_path(@private_key_path) @@ -56,6 +60,10 @@ module Fog @private_key ||= private_key_path && File.read(private_key_path) end + def public_ip_address + addresses.first + end + def public_key_path @public_key_path ||= Fog.credentials[:public_key_path] @public_key_path &&= File.expand_path(@public_key_path) diff --git a/lib/fog/compute/models/slicehost/server.rb b/lib/fog/compute/models/slicehost/server.rb index 1886f1167..e71ec2566 100644 --- a/lib/fog/compute/models/slicehost/server.rb +++ b/lib/fog/compute/models/slicehost/server.rb @@ -43,6 +43,10 @@ module Fog connection.images.get(image_id) end + def private_ip_address + nil + end + def private_key_path @private_key_path ||= Fog.credentials[:private_key_path] @private_key_path &&= File.expand_path(@private_key_path) @@ -52,6 +56,10 @@ module Fog @private_key ||= private_key_path && File.read(private_key_path) end + def public_ip_address + addresses.first + end + def public_key_path @public_key_path ||= Fog.credentials[:public_key_path] @public_key_path &&= File.expand_path(@public_key_path) diff --git a/tests/compute/models/server_tests.rb b/tests/compute/models/server_tests.rb index d16553d8a..60b7cbb15 100644 --- a/tests/compute/models/server_tests.rb +++ b/tests/compute/models/server_tests.rb @@ -2,7 +2,24 @@ for provider, config in compute_providers Shindo.tests("#{provider}::Compute | server", [provider.to_s.downcase]) do - server_tests(provider[:compute], (config[:server_attributes] || {}), config[:mocked]) + server_tests(provider[:compute], (config[:server_attributes] || {}), config[:mocked]) do + + tests('responds_to(:bootstrap)') do + pending if Fog.mocking? && !config[:mocked] + @instance.responds_to(:bootstrap) + end + + tests('responds_to(:private_ip_address)') do + pending if Fog.mocking? && !config[:mocked] + @instance.responds_to(:public_ip_address) + end + + tests('responds_to(:public_ip_address)') do + pending if Fog.mocking? && !config[:mocked] + @instance.responds_to(:public_ip_address) + end + + end end diff --git a/tests/storage/models/directory_test.rb b/tests/storage/models/directory_test.rb index c895cf738..833597cbc 100644 --- a/tests/storage/models/directory_test.rb +++ b/tests/storage/models/directory_test.rb @@ -13,7 +13,8 @@ for provider, config in storage_providers @instance.public=(true) end - if !Fog.mocking? || config[:mocked] + tests('responds_to(:public_url)') do + pending if Fog.mocking? && !config[:mocked] @instance.responds_to(:public_url) end