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

Add ability to specify availability zone for subnet during creation

This commit is contained in:
jschneiderhan 2013-09-06 12:47:51 -04:00
parent de7fe5b768
commit 751795d9c6
3 changed files with 5 additions and 3 deletions

View file

@ -43,7 +43,9 @@ module Fog
def save
requires :vpc_id, :cidr_block
data = service.create_subnet(vpc_id, cidr_block).body['subnetSet'].first
options = {}
options['AvailabilityZone'] = availability_zone if availability_zone
data = service.create_subnet(vpc_id, cidr_block, options).body['subnetSet'].first
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true

View file

@ -1,5 +1,5 @@
Shindo.tests("Fog::Compute[:aws] | subnet", ['aws']) do
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
model_tests(Fog::Compute[:aws].subnets, {:vpc_id => @vpc.id, :cidr_block => '10.0.10.0/28'}, true)
model_tests(Fog::Compute[:aws].subnets, {:vpc_id => @vpc.id, :cidr_block => '10.0.10.0/28', :availability_zone => 'us-east-1b'}, true)
@vpc.destroy
end

View file

@ -1,6 +1,6 @@
Shindo.tests("Fog::Compute[:aws] | subnets", ['aws']) do
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/28')
collection_tests(Fog::Compute[:aws].subnets, { :vpc_id => @vpc.id, :cidr_block => '10.0.10.0/28'}, true)
collection_tests(Fog::Compute[:aws].subnets, { :vpc_id => @vpc.id, :cidr_block => '10.0.10.0/28', :availability_zone => 'us-east-1c'}, true)
@vpc.destroy
end