mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
parent
8fdab3e8b4
commit
9a40a17e9f
8 changed files with 62 additions and 4 deletions
|
@ -5,6 +5,8 @@ module Fog
|
||||||
class Compute
|
class Compute
|
||||||
|
|
||||||
class Server < Fog::Model
|
class Server < Fog::Model
|
||||||
|
include Fog::Deprecation
|
||||||
|
deprecate :ip_address, :public_ip_address
|
||||||
|
|
||||||
identity :id, :aliases => 'instanceId'
|
identity :id, :aliases => 'instanceId'
|
||||||
|
|
||||||
|
@ -18,7 +20,6 @@ module Fog
|
||||||
attribute :flavor_id, :aliases => 'instanceType'
|
attribute :flavor_id, :aliases => 'instanceType'
|
||||||
attribute :image_id, :aliases => 'imageId'
|
attribute :image_id, :aliases => 'imageId'
|
||||||
attr_accessor :instance_initiated_shutdown_behavior
|
attr_accessor :instance_initiated_shutdown_behavior
|
||||||
attribute :ip_address, :aliases => 'ipAddress'
|
|
||||||
attribute :kernel_id, :aliases => 'kernelId'
|
attribute :kernel_id, :aliases => 'kernelId'
|
||||||
attribute :key_name, :aliases => 'keyName'
|
attribute :key_name, :aliases => 'keyName'
|
||||||
attribute :created_at, :aliases => 'launchTime'
|
attribute :created_at, :aliases => 'launchTime'
|
||||||
|
@ -26,6 +27,7 @@ module Fog
|
||||||
attribute :product_codes, :aliases => 'productCodes'
|
attribute :product_codes, :aliases => 'productCodes'
|
||||||
attribute :private_dns_name, :aliases => 'privateDnsName'
|
attribute :private_dns_name, :aliases => 'privateDnsName'
|
||||||
attribute :private_ip_address, :aliases => 'privateIpAddress'
|
attribute :private_ip_address, :aliases => 'privateIpAddress'
|
||||||
|
attribute :public_ip_address, :aliases => 'ipAddress'
|
||||||
attribute :ramdisk_id, :aliases => 'ramdiskId'
|
attribute :ramdisk_id, :aliases => 'ramdiskId'
|
||||||
attribute :reason
|
attribute :reason
|
||||||
attribute :root_device_name, :aliases => 'rootDeviceName'
|
attribute :root_device_name, :aliases => 'rootDeviceName'
|
||||||
|
|
|
@ -45,6 +45,10 @@ module Fog
|
||||||
connection.images.get(image_id)
|
connection.images.get(image_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_ip_address
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def private_key_path
|
def private_key_path
|
||||||
@private_key_path ||= Fog.credentials[:private_key_path]
|
@private_key_path ||= Fog.credentials[:private_key_path]
|
||||||
@private_key_path &&= File.expand_path(@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)
|
@private_key ||= private_key_path && File.read(private_key_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public_ip_address
|
||||||
|
ips.first
|
||||||
|
end
|
||||||
|
|
||||||
def public_key_path
|
def public_key_path
|
||||||
@public_key_path ||= Fog.credentials[:public_key_path]
|
@public_key_path ||= Fog.credentials[:public_key_path]
|
||||||
@public_key_path &&= File.expand_path(@public_key_path)
|
@public_key_path &&= File.expand_path(@public_key_path)
|
||||||
|
|
|
@ -71,6 +71,14 @@ module Fog
|
||||||
connection.images.get(image_id)
|
connection.images.get(image_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_ip_address
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def public_ip_address
|
||||||
|
cloud_ips.first
|
||||||
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
status == 'active'
|
status == 'active'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,12 +7,14 @@ module Fog
|
||||||
class BlockInstantiationError < StandardError; end
|
class BlockInstantiationError < StandardError; end
|
||||||
|
|
||||||
class Server < Fog::Model
|
class Server < Fog::Model
|
||||||
|
include Fog::Deprecation
|
||||||
|
deprecate(:ip, :public_ip_address)
|
||||||
|
|
||||||
identity :id
|
identity :id
|
||||||
|
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :image_id # id or name
|
attribute :image_id # id or name
|
||||||
attribute :ip
|
attribute :public_ip_address, :aliases => 'ip'
|
||||||
attribute :memory # server.ram
|
attribute :memory # server.ram
|
||||||
attribute :state
|
attribute :state
|
||||||
attribute :description # Optional
|
attribute :description # Optional
|
||||||
|
@ -33,6 +35,10 @@ module Fog
|
||||||
connection.grid_image_get(:image => image_id)
|
connection.grid_image_get(:image => image_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_ip_address
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
@state && @state["name"] == 'On'
|
@state && @state["name"] == 'On'
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,6 +47,10 @@ module Fog
|
||||||
connection.images(:server => self)
|
connection.images(:server => self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_ip_address
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def private_key_path
|
def private_key_path
|
||||||
@private_key_path ||= Fog.credentials[:private_key_path]
|
@private_key_path ||= Fog.credentials[:private_key_path]
|
||||||
@private_key_path &&= File.expand_path(@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)
|
@private_key ||= private_key_path && File.read(private_key_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public_ip_address
|
||||||
|
addresses.first
|
||||||
|
end
|
||||||
|
|
||||||
def public_key_path
|
def public_key_path
|
||||||
@public_key_path ||= Fog.credentials[:public_key_path]
|
@public_key_path ||= Fog.credentials[:public_key_path]
|
||||||
@public_key_path &&= File.expand_path(@public_key_path)
|
@public_key_path &&= File.expand_path(@public_key_path)
|
||||||
|
|
|
@ -43,6 +43,10 @@ module Fog
|
||||||
connection.images.get(image_id)
|
connection.images.get(image_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_ip_address
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def private_key_path
|
def private_key_path
|
||||||
@private_key_path ||= Fog.credentials[:private_key_path]
|
@private_key_path ||= Fog.credentials[:private_key_path]
|
||||||
@private_key_path &&= File.expand_path(@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)
|
@private_key ||= private_key_path && File.read(private_key_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public_ip_address
|
||||||
|
addresses.first
|
||||||
|
end
|
||||||
|
|
||||||
def public_key_path
|
def public_key_path
|
||||||
@public_key_path ||= Fog.credentials[:public_key_path]
|
@public_key_path ||= Fog.credentials[:public_key_path]
|
||||||
@public_key_path &&= File.expand_path(@public_key_path)
|
@public_key_path &&= File.expand_path(@public_key_path)
|
||||||
|
|
|
@ -2,7 +2,24 @@ for provider, config in compute_providers
|
||||||
|
|
||||||
Shindo.tests("#{provider}::Compute | server", [provider.to_s.downcase]) do
|
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
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ for provider, config in storage_providers
|
||||||
@instance.public=(true)
|
@instance.public=(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if !Fog.mocking? || config[:mocked]
|
tests('responds_to(:public_url)') do
|
||||||
|
pending if Fog.mocking? && !config[:mocked]
|
||||||
@instance.responds_to(:public_url)
|
@instance.responds_to(:public_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue