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

Fix bug which deleted project bucket instead of project contents only #1172

Merged
merged 7 commits into from
May 13, 2022

Conversation

i-oden
Copy link
Member

@i-oden i-oden commented May 13, 2022

Description

A user at NGI Stockholm noted that he created a project, uploaded data, used dds data rm --rm-all and then tried to upload data to the same project. The last step resulted in a long traceback complaining that there was no such bucket. Turns out the delete_project_contents used by the RemoveContents endpoint, and by the project-deleting/archiving also removes the buckets which is not intended.

In this PR I have changed the name of the S3Connector method to remove_bucket_contents instead of remove_bucket and added a kwarg called delete_bucket (default False). When the projects are being archived or deleted, this should be set to True.

  • Summary of the changes and the related issue
  • Relevant motivation and context
  • Any dependencies that are required for this change

Fixes DDS-1283

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

Please delete options that are not relevant.

  • Any dependent changes have been merged and published in downstream modules
  • Rebase/merge the branch which this PR is made to
  • Changes to the database schema: A new migration is included in the PR

Formatting and documentation

  • I have added a row in the changelog
  • The code follows the style guidelines of this project: Black / Prettier formatting
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Tests

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…ucket' variable to cater to project deleting and archiving
@i-oden i-oden self-assigned this May 13, 2022
@i-oden i-oden requested a review from valyo May 13, 2022 12:08
@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #1172 (6d7e402) into dev (02cfa45) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##              dev    #1172   +/-   ##
=======================================
  Coverage   84.31%   84.31%           
=======================================
  Files          29       29           
  Lines        3614     3615    +1     
=======================================
+ Hits         3047     3048    +1     
  Misses        567      567           
Impacted Files Coverage Δ
dds_web/api/api_s3_connector.py 89.74% <100.00%> (+0.26%) ⬆️
dds_web/api/project.py 84.86% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02cfa45...6d7e402. Read the comment docs.

Copy link
Member

@valyo valyo left a comment

Choose a reason for hiding this comment

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

Worked when tested and seems fine, apart from my comment

dds_web/api/project.py Outdated Show resolved Hide resolved
@i-oden i-oden merged commit 30182cf into dev May 13, 2022
@i-oden i-oden deleted the DDS-1283_bucket-deleted-with-rm-all branch May 13, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants