-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security Group perms of FromPort 0 and ToPort -1 #223
Conversation
I can see 0 as min, but why -1 as the default for max? Why not 0 for both? Or maybe even some other value? Sorry if I just lack context/understanding on this, haven't messed with this feature in ages. |
because an alternative might be something like If we could go back in time and just accept 2 arguments instead of a range it would probably be cleaner.. Or maybe we need a new object |
Well, my question was maybe rather unclear. More directly, what is the context in which 0..-1 is the intended/desired value? |
Apparently 0 to -1 is a valid ICMP port range... we were trying to delete a security group, and had to delete permissions, ran across a permission with port range 0 to -1 so generated a call to fog with |
Got it. How about we just allow you to pass from/to port options explicitly in the options hash to override the range values? Seems like that would be more explicit/less magical. I just worry that these defaults might work in the particular case you describe but cause unintended issues in other cases. What do you think? |
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
93b7b87
to
4abac8e
Compare
Ok, sorry, I guess my initial "fix" was a bit hasty, here's a better one I think (It is a bit strange that the methods are called |
@jacobo no worries, the quickest fix is usually the right one to reach for. I just was wary of side effects. I didn't even know about begin/end, sounds promising though. |
soo... what's next, merge? do we need tests? |
@jacobo yes. Sorry, I didn't realize the begin/end changes were already done. Thanks! |
Security Group perms of FromPort 0 and ToPort -1
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
andmax
to get the parts of a range can somtimes return nil, usingbegin
andend
will always return the actual values the range was created withExample:
(0..-1).min
is nil and(0..-1).max
is also nilError message from AWS would be:
Invalid value 'Must specify both from and to ports with ICMP.' for portRange