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

Merge pull request #1724 from ehowe/aws_phantom_security_group

[aws] Handle the "phantom" security group that exists for elbs
This commit is contained in:
Wesley Beary 2013-04-03 12:33:33 -07:00
commit 9c21a77b53
2 changed files with 12 additions and 2 deletions

View file

@ -55,7 +55,7 @@ module Fog
response = Excon::Response.new
security_group_info = self.data[:security_groups].values
security_group_info = self.data[:security_groups].reject { |k,v| k['amazon-elb-sg'] }.values
aliases = {
'description' => 'groupDescription',
@ -71,7 +71,7 @@ module Fog
}
for filter_key, filter_value in filters
if permission_key = filter_key.split('ip-permission.')[1]
if permission_key == 'group-name'
if permission_key == 'group-name'
security_group_info = security_group_info.reject{|security_group| !security_group['ipPermissions']['groups'].detect {|group| [*filter_value].include?(group['groupName'])}}
elsif permission_key == 'group-id'
security_group_info = security_group_info.reject{|security_group| !security_group['ipPermissions']['groups'].detect {|group| [*filter_value].include?(group['groupId'])}}

View file

@ -73,6 +73,16 @@ module Fog
end
dns_name = Fog::AWS::ELB::Mock.dns_name(lb_name, @region)
Fog::Compute::AWS::Mock.data[@region][@aws_access_key_id][:security_groups]['amazon-elb-sg'] ||= {
'groupDescription' => 'amazon-elb-sg',
'groupName' => 'amazon-elb-sg',
'groupId' => 'amazon-elb',
'ownerId' => 'amazon-elb',
'ipPermissionsEgree' => [],
'ipPermissions' => [],
}
self.data[:load_balancers][lb_name] = {
'AvailabilityZones' => availability_zones,
'Subnets' => options[:subnet_ids] || [],