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

Merge pull request #1037 from akatz/master

Don't stop all instances when mocking
This commit is contained in:
Edward Muller 2012-07-13 10:45:55 -07:00
commit bcfc1df3b0
4 changed files with 7 additions and 1 deletions

View file

@ -186,6 +186,10 @@ module Fog
ip.join('.')
end
def self.private_ip_address
ip_address.gsub(/^\d{1,3}\./,"10.")
end
def self.kernel_id
"aki-#{Fog::Mock.random_hex(8)}"
end

View file

@ -179,7 +179,7 @@ module Fog
instance['ipAddress'] = Fog::AWS::Mock.ip_address
instance['originalIpAddress'] = instance['ipAddress']
instance['dnsName'] = Fog::AWS::Mock.dns_name_for(instance['ipAddress'])
instance['privateIpAddress'] = Fog::AWS::Mock.ip_address
instance['privateIpAddress'] = Fog::AWS::Mock.private_ip_address
instance['privateDnsName'] = Fog::AWS::Mock.private_dns_name_for(instance['privateIpAddress'])
instance['instanceState'] = { 'code' => 16, 'name' => 'running' }
end

View file

@ -34,6 +34,7 @@ module Fog
instance_set = self.data[:instances].values
instance_set = apply_tag_filters(instance_set, {'instance_id' => instance_ids}, 'instanceId')
instance_set = instance_set.find_all {|x| instance_ids.include?(x["instanceId"]) }
if instance_set.empty?
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_ids.first}' does not exist")

View file

@ -35,6 +35,7 @@ module Fog
instance_set = self.data[:instances].values
instance_set = apply_tag_filters(instance_set, {'instance_id' => instance_ids}, 'instanceId')
instance_set = instance_set.find_all {|x| instance_ids.include?(x["instanceId"]) }
if instance_set.empty?
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_ids.first}' does not exist")