Skip to content

Commit

Permalink
Use same structure as delete_route() for determining cidr string
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisGaul committed Jun 22, 2023
1 parent b21131c commit 1d8ca4a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions moto/ec2/models/route_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,18 +448,18 @@ def replace_route(
interface_id: Optional[str] = None,
vpc_peering_connection_id: Optional[str] = None,
) -> Route:
cidr = destination_cidr_block
if destination_ipv6_cidr_block:
cidr = destination_ipv6_cidr_block
if destination_prefix_list_id:
cidr = destination_prefix_list_id
route_table = self.get_route_table(route_table_id)
route_id = generate_route_id(
route_table.id, destination_cidr_block, destination_ipv6_cidr_block
)
try:
route = route_table.routes[route_id]
except KeyError:
cidr = (
destination_cidr_block
if destination_cidr_block
else destination_ipv6_cidr_block
)
# This should be 'raise InvalidRouteError(route_table_id, cidr)' in
# line with the delete_route() equivalent, but for some reason AWS
# returns InvalidParameterValue instead in this case.
Expand Down

0 comments on commit 1d8ca4a

Please sign in to comment.