Fix multiple 'Deleted' strings from logs#1000
Merged
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request refactors a single method call in NAT gateway cleanup to restructure Elasticsearch schema argument passing. The ChangesNAT Gateway Cleanup Schema Argument Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Note: Fill x in []
Issue
In the unused_nat_gateway.py policy, when a NAT Gateway was successfully deleted, the code was setting unit_price="Deleted" (a string) instead of keeping it as a numeric value.
The _get_es_schema method then tries to calculate TotalYearlySavings by calling __current_savings_year(unit_price), which does:
total_days * 24 * unit_price
When unit_price is the string "Deleted", Python's string multiplication creates:
24 * "Deleted" = "Deleted" repeated 24 times
Then total_days * (that result) = "Deleted" repeated ~4,000+ times (24 hours × ~175 days remaining in year)
For security reasons, all pull requests need to be approved first before running any automated CI
Assisted-by: Cursor