Closed jamelachahbar closed 1 month ago
@flanakin , do you want me to squash and merge this?
@jamelachahbar I looked at the integration tests we have here, which weren't working before. I was able to get something working for now, so we have an automated test for this. I updated that in the branch, so we're in a good state.
Thanks for getting this in!
π οΈ Description
Get-HubIdentifier.ps1:
I optimized the logic to directly extract a valid 13-character alphanumeric string and improve efficiency. The current method generates substrings unnecessarily (tested it with Verbose Output), slowing down performance and producing irrelevant results. Regex Matching: Uses a regular expression to directly extract 13-character alphanumeric strings, removing the need for substring generation. Excludes Special Characters: Filters out matches with hyphens or underscores to ensure a clean identifier. Efficiency: Processes each string once, significantly improving performance for large collections.
Remove-FinOpsHub.ps1
This PR simplifies the Remove-FinOpsHub logic by replacing the .Reduce() method with a more sequential foreach loop for deleting resources. It improves error handling, ensuring each resource deletion attempt is properly logged and handled individually. The script now includes clearer verbose messages for filtered resources, deletion attempts, and success statuses. These changes provide better transparency and avoid potential issues caused by parallel deletion, making the script more predictable and easier to debug.
Fixes #
554
π Checklist
π¬ How did you test this change?
πββοΈ Do any of the following that apply?
π Did you update
docs/changelog.md
?π Did you update documentation?