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

[aws|compute] better region/zone handling for mocks

This commit is contained in:
geemus 2011-05-17 10:32:44 -07:00
parent cd2c781498
commit 2725e312fd
3 changed files with 8 additions and 3 deletions
lib/fog
compute
providers

View file

@ -136,6 +136,11 @@ module Fog
require 'fog/compute/parsers/aws/basic'
@aws_access_key_id = options[:aws_access_key_id]
unless ['ap-northeast-1', 'ap-southeast-1', 'eu-west-1', 'us-east-1', 'us-west-1'].include?(options[:region])
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
end
@region = options[:region] || 'us-east-1'
@data = self.class.data[@region][@aws_access_key_id]

View file

@ -133,7 +133,7 @@ module Fog
# 'keyName' => options['KeyName'],
'launchTime' => Time.now,
'monitoring' => { 'state' => options['Monitoring.Enabled'] || false },
'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone },
'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region) },
'privateDnsName' => nil,
'productCodes' => [],
'ramdiskId' => options['RamdiskId'] || Fog::AWS::Mock.ramdisk_id,

View file

@ -69,8 +69,8 @@ module Fog
class Mock
def self.availability_zone
"us-east-1" << Fog::Mock.random_selection('abcd', 1)
def self.availability_zone(region)
"#{region}#{Fog::Mock.random_selection('abcd', 1)}"
end
def self.box_usage