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

Merge pull request #2335 from faber/aws-internet-gateway-parser-bugfix

Fix parser typo in AWS #describe_internet_gateways
This commit is contained in:
Wesley Beary 2013-10-30 11:29:13 -07:00
commit c64f71921b
7 changed files with 15 additions and 8 deletions

View file

@ -223,7 +223,6 @@ module Fog
:subnets => [],
:vpcs => [],
:dhcp_options => [],
:internet_gateways => [],
:route_tables => [],
:account_attributes => [
{

View file

@ -26,7 +26,7 @@ module Fog
if @in_tag_set
case name
when 'item'
@vpc['tagSet'][@tag['key']] = @tag['value']
@internet_gateway['tagSet'][@tag['key']] = @tag['value']
@tag = {}
when 'key', 'value'
@tag[name] = value

View file

@ -33,16 +33,17 @@ module Fog
class Mock
def create_internet_gateway()
self.data[:internet_gateways].push({
'internetGatewayId' => Fog::AWS::Mock.request_id,
gateway_id = Fog::AWS::Mock.internet_gateway_id
self.data[:internet_gateways][gateway_id] = {
'internetGatewayId' => gateway_id,
'attachmentSet' => {},
'tagSet' => {}
})
}
Excon::Response.new(
:status => 200,
:body => {
'requestId' => Fog::AWS::Mock.request_id,
'internetGatewaySet' => self.data[:internet_gateways]
'internetGatewaySet' => [self.data[:internet_gateways][gateway_id]]
}
)
end

View file

@ -53,6 +53,8 @@ module Fog
'snapshot'
when /^vol\-[a-z0-9]{8}$/i
'volume'
when /^igw\-[a-z0-9]{8}$/i
'internet_gateway'
end
if type && ((type == 'image' && visible_images[resource_id]) || self.data[:"#{type}s"][resource_id])
{ 'resourceId' => resource_id, 'resourceType' => type }

View file

@ -30,7 +30,7 @@ module Fog
Excon::Response.new.tap do |response|
if internet_gateway_id
response.status = 200
self.data[:internet_gateways].reject! { |v| v['internetGatewayId'] == internet_gateway_id }
self.data[:internet_gateways].delete(internet_gateway_id)
response.body = {
'requestId' => Fog::AWS::Mock.request_id,

View file

@ -40,7 +40,7 @@ module Fog
class Mock
def describe_internet_gateways(filters = {})
internet_gateways = self.data[:internet_gateways]
internet_gateways = self.data[:internet_gateways].values
if filters['internet-gateway-id']
internet_gateways = internet_gateways.reject {|internet_gateway| internet_gateway['internetGatewayId'] != filters['internet-gateway-id']}

View file

@ -26,6 +26,11 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
tests('#describe_internet_gateways').formats(@internet_gateways_format) do
Fog::Compute[:aws].describe_internet_gateways.body
end
tests('#describe_internet_gateways with tags').formats(@internet_gateways_format) do
Fog::Compute[:aws].create_tags @igw_id, {"environment" => "production"}
Fog::Compute[:aws].describe_internet_gateways.body
end
tests("#attach_internet_gateway('#{@igw_id}, #{@vpc_id}')").formats(AWS::Compute::Formats::BASIC) do
Fog::Compute[:aws].attach_internet_gateway(@igw_id, @vpc_id).body