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

Setup VPC mocks to create a default route table.

This commit is contained in:
Robert Clark 2013-08-08 14:40:36 -04:00
parent 7fa654b49c
commit b9794ae64e

View file

@ -43,14 +43,29 @@ module Fog
Excon::Response.new.tap do |response|
if cidrBlock
response.status = 200
vpc_id = Fog::AWS::Mock.request_id
self.data[:vpcs].push({
'vpcId' => Fog::AWS::Mock.request_id,
'vpcId' => vpc_id,
'state' => 'pending',
'cidrBlock' => cidrBlock,
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
'tagSet' => {}
})
#Creates a default route for the subnet
default_route = self.route_tables.new(:vpc_id => vpc_id)
default_route.save
# You are not able to push a main route in the normal AWS, so we are re-implementing some of the
# associate_route_table here in order to accomplish this.
route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? default_route.id }
# This pushes a main route to the associationSet
# add_route_association(routeTableId, subnetId, main=false) is declared in assocate_route_table.rb
assoc = add_route_association(default_route.id, nil, true)
route_table["associationSet"].push(assoc)
response.body = {
'requestId' => Fog::AWS::Mock.request_id,
'vpcSet' => self.data[:vpcs]