Make security rules consistent between direct (backend) and indirect (api) boundaries (#3817)
* Make security rules consistent between direct (backend) and indirect (api) boundaries Security rules added directly via the backend were unable to be revoked via the API because the port values were being stored as strings but were always coerced back to integers by the botocore model. `"0" != 0`, so the rules would never match, raising an `InvalidPermissionNotFoundError`. This change ensures that the port values for a security group rule are always of type `Union[int, None]`. No tests needed to be modified as a result of this change. A new test was added that explicitly covers the behavior that had been failing. * Skip test in server mode
This commit is contained in:
parent
ec168cf24c
commit
463472c2b2
3 changed files with 60 additions and 7 deletions
|
|
@ -1984,10 +1984,11 @@ class SecurityRule(object):
|
|||
self.ip_protocol = ip_protocol
|
||||
self.ip_ranges = ip_ranges or []
|
||||
self.source_groups = source_groups
|
||||
self.from_port = self.to_port = None
|
||||
|
||||
if ip_protocol != "-1":
|
||||
self.from_port = from_port
|
||||
self.to_port = to_port
|
||||
self.from_port = int(from_port)
|
||||
self.to_port = int(to_port)
|
||||
|
||||
def __eq__(self, other):
|
||||
if self.ip_protocol != other.ip_protocol:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue