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

Merge pull request #2569 from gaurish/security_group_check

Check if security group is nil, fixes #2507
This commit is contained in:
Wesley Beary 2014-01-16 07:14:35 -08:00
commit a54b9757a9

View file

@ -85,8 +85,13 @@ module Fog
end
end
# make sure port 22 is open in the first security group
security_group = service.security_groups.get(server.groups.first)
if security_group.nil?
raise Fog::Compute::AWS::Error, "The security group" \
" #{server.groups.first} doesn't exist."
end
# make sure port 22 is open in the first security group
authorized = security_group.ip_permissions.detect do |ip_permission|
ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
ip_permission['fromPort'] == 22 &&