Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(azure): New check storage_ensure_soft_delete_is_enabled #3334

Merged
merged 6 commits into from Jan 31, 2024

Conversation

pedrooot
Copy link
Contributor

@pedrooot pedrooot commented Jan 30, 2024

Context

This pr contains a the new Azure check storage_ensure_soft_delete_is_enabled

Description

This check makes this task:

  • Ensure Soft Delete is Enabled for Azure Containers and Blob Storage

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pedrooot pedrooot requested a review from a team as a code owner January 30, 2024 10:55
@pedrooot pedrooot changed the title Storage ensure soft delete is enabled feat(azure): New check storage_ensure_soft_delete_is_enabled Jan 30, 2024
Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (db45794) 85.91% compared to head (f21dcc3) 85.87%.
Report is 7 commits behind head on master.

Files Patch % Lines
...roviders/azure/services/storage/storage_service.py 76.92% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3334      +/-   ##
==========================================
- Coverage   85.91%   85.87%   -0.04%     
==========================================
  Files         568      571       +3     
  Lines       18345    18441      +96     
==========================================
+ Hits        15761    15837      +76     
- Misses       2584     2604      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

report.resource_name = storage_account.name
report.resource_id = storage_account.id
if (
storage_account.blob_properties.container_delete_retention_policy.enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if storage_account.blob_properties is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! I modify it to handle correctly.
Thanks for the review

@@ -42,11 +53,42 @@ def __get_storage_accounts__(self):
)
return storage_accounts

def __get_blob_properties__(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the test of this function in storage_service_test.py, pleae?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Member

@sergargar sergargar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, review my comments.

@sergargar sergargar added the provider/azure Issues/PRs related with the Azure provider label Jan 30, 2024
@sergargar sergargar self-requested a review January 31, 2024 12:28
Copy link
Member

@sergargar sergargar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!!

@sergargar sergargar merged commit 6e99110 into master Jan 31, 2024
7 of 8 checks passed
@sergargar sergargar deleted the storage_ensure_soft_delete_is_enabled branch January 31, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/azure Issues/PRs related with the Azure provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants