Skip to content

Commit

Permalink
Merge pull request #17 from cooperwalbrun/subnet-states
Browse files Browse the repository at this point in the history
Consider IPv6 Subnets in an "associating" State
  • Loading branch information
cooperwalbrun authored Nov 20, 2022
2 parents 1c8ad14 + 36b990c commit ce596d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Nothing currently!

## v0.3.1 - 2022-11-20

### Changed

* IPv6 subnets in an `associating` state are now recognized by `aws-cidr-finder` (by [@cooperwalbrun](https://github.com/cooperwalbrun))

## v0.3.0 - 2022-11-16

### Added
Expand Down
8 changes: 4 additions & 4 deletions src/aws_cidr_finder/boto_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def _parse_vpc_cidrs(vpc: VpcTypeDef, *, ipv6: bool) -> list[str]:
if ipv6:
return [
association["Ipv6CidrBlock"]
for association in vpc.get("Ipv6CidrBlockAssociationSet", [])
for association in vpc["Ipv6CidrBlockAssociationSet"]
if association["Ipv6CidrBlockState"]["State"] in ["associated", "associating"]
]
else:
return [
association["CidrBlock"]
for association in vpc.get("CidrBlockAssociationSet", [])
for association in vpc["CidrBlockAssociationSet"]
if association["CidrBlockState"]["State"] in ["associated", "associating"]
]

Expand All @@ -40,8 +40,8 @@ def _parse_subnet_cidrs(subnets: list[SubnetTypeDef], *, ipv6: bool) -> list[str
return [
association["Ipv6CidrBlock"]
for subnet in subnets
for association in subnet.get("Ipv6CidrBlockAssociationSet", [])
if association["Ipv6CidrBlockState"]["State"] == "associated"
for association in subnet["Ipv6CidrBlockAssociationSet"]
if association["Ipv6CidrBlockState"]["State"] in ["associated", "associating"]
]
else:
return [subnet["CidrBlock"] for subnet in subnets if "CidrBlock" in subnet]
Expand Down

0 comments on commit ce596d4

Please sign in to comment.