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

Security Group perms of FromPort 0 and ToPort -1

Fix generation of the FromPort and ToPort paramters when authorizing or
revoking permissions on a security group.

Using `min` and `max` to get the parts of a range can somtimes return
nil, using `begin` and `end` will always return the actual values the
range was created with

Example: `(0..-1).min` is nil and `(0..-1).max` is also nil

Error message from AWS would be:

Invalid value 'Must specify both from and to ports with ICMP.' for
portRange
This commit is contained in:
Jacob Burkhart 2016-02-03 12:00:56 -08:00
parent 57290fc5da
commit 4abac8e454

View file

@ -83,8 +83,8 @@ module Fog
requires_one :name, :group_id requires_one :name, :group_id
ip_permission = { ip_permission = {
'FromPort' => range.min, 'FromPort' => range.begin,
'ToPort' => range.max, 'ToPort' => range.end,
'IpProtocol' => options[:ip_protocol] || 'tcp' 'IpProtocol' => options[:ip_protocol] || 'tcp'
} }
@ -197,8 +197,8 @@ module Fog
requires_one :name, :group_id requires_one :name, :group_id
ip_permission = { ip_permission = {
'FromPort' => range.min, 'FromPort' => range.begin,
'ToPort' => range.max, 'ToPort' => range.end,
'IpProtocol' => options[:ip_protocol] || 'tcp' 'IpProtocol' => options[:ip_protocol] || 'tcp'
} }