Return error when trying to add rules to a non-existent security group (#3802)
Behavior and error code/message confirmed against real AWS backend.
This commit is contained in:
parent
2bae7e4e0d
commit
1761be46e3
2 changed files with 20 additions and 0 deletions
|
|
@ -2265,6 +2265,8 @@ class SecurityGroupBackend(object):
|
|||
vpc_id=None,
|
||||
):
|
||||
group = self.get_security_group_by_name_or_id(group_name_or_id, vpc_id)
|
||||
if group is None:
|
||||
raise InvalidSecurityGroupNotFoundError(group_name_or_id)
|
||||
if ip_ranges:
|
||||
if isinstance(ip_ranges, str) or (
|
||||
six.PY2 and isinstance(ip_ranges, unicode) # noqa
|
||||
|
|
@ -2353,6 +2355,8 @@ class SecurityGroupBackend(object):
|
|||
):
|
||||
|
||||
group = self.get_security_group_by_name_or_id(group_name_or_id, vpc_id)
|
||||
if group is None:
|
||||
raise InvalidSecurityGroupNotFoundError(group_name_or_id)
|
||||
if ip_ranges and not isinstance(ip_ranges, list):
|
||||
|
||||
if isinstance(ip_ranges, str) and "CidrIp" not in ip_ranges:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue