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

Check if security group is nil, fixes #2507

This commit is contained in:
Gaurish Sharma 2014-01-12 02:16:02 +05:30
parent 612e33ac17
commit 9d386f291f

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 &&