Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianncarlo Giannattasio committed Mar 20, 2024
1 parent 353e0c3 commit b2c9c83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions c7n/resources/vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2904,15 +2904,15 @@ class SubnetIpAllocationFilter(Filter):
schema = type_schema(
'ip-allocation-threshold',
percentage={'type': 'number'},
op={'enum': ['eq', 'ne', 'lt', 'gt', 'lte', 'gte']},
op={'enum': ['eq', 'ne', 'lt', 'gt', 'lte', 'gte']}
)

permissions = ("ec2:DescribeSubnets",)

def calculate_ip_allocation(self, subnet):
subnetMask = subnet.get('CidrBlock').split('/')[1]
hostBits = 32 - int(subnetMask)
totalHost = (2**hostBits) - 2
totalHost = (2 ** hostBits) - 2
availableHost = subnet.get('AvailableIpAddressCount')
ipsUsed = totalHost - availableHost
percentageOfIpsUsed = (ipsUsed / totalHost) * 100
Expand Down Expand Up @@ -2946,4 +2946,4 @@ def process(self, resources, event=None):
percentage_used == threshold_percentage
):
results.append(subnet)
return result
return results

0 comments on commit b2c9c83

Please sign in to comment.