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:
parent
612e33ac17
commit
9d386f291f
1 changed files with 7 additions and 2 deletions
|
@ -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 &&
|
||||
|
|
Loading…
Reference in a new issue