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:
commit
a54b9757a9
1 changed files with 7 additions and 2 deletions
|
@ -84,9 +84,14 @@ 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