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

Ensure repo deletion also removes associated content and artifacts #1603

Merged
merged 24 commits into from
Feb 28, 2023

Conversation

ShaiahWren
Copy link
Contributor

@ShaiahWren ShaiahWren commented Jan 30, 2023

Issue: AAH-2024

Prior to this pr, the delete_container_distribution method deleted the repo from the system, yet the associated content and artifacts remained.

To ensure all content is deleted, the content_pks in orphan cleanup for the method is now set to the content pks for the given repository and the orphan protection time, set to 0.

Plan of action:

  1. Grab the repo ids through list comprehension of the instance_ids passed into the deletion method
  2. Query objects in the RepositoryContent model and filter out the content pks associated with those repo ids. ( RepositoryContent.objects.filter(repository__pk__in = repo ids).values_list("content_pks").
  3. Assign that list of content pks to the content pks field for orphan cleanup and set orphan_protection_time to 0.

That should be it!

@netlify
Copy link

netlify bot commented Jan 30, 2023

Deploy Preview for galaxyng ready!

Name Link
🔨 Latest commit c8df9a7
🔍 Latest deploy log https://app.netlify.com/sites/galaxyng/deploys/63fe17415a6c69000817dba1
😎 Deploy Preview https://deploy-preview-1603--galaxyng.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ShaiahWren ShaiahWren marked this pull request as draft January 30, 2023 16:52
@github-actions github-actions bot added backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3) labels Jan 30, 2023
@ShaiahWren ShaiahWren force-pushed the galaxy-not-deleting-repo branch 15 times, most recently from 6dd3550 to eab21e1 Compare February 4, 2023 15:09
@ShaiahWren ShaiahWren marked this pull request as ready for review February 6, 2023 15:42
@newswangerd newswangerd removed backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) backport-4.5 This PR should be backported to stable-4.5 (2.2) labels Feb 6, 2023
@ShaiahWren ShaiahWren force-pushed the galaxy-not-deleting-repo branch 4 times, most recently from 4b11c21 to 608f186 Compare February 6, 2023 20:07
@newswangerd newswangerd merged commit d1dfb7b into ansible:master Feb 28, 2023
@patchback
Copy link

patchback bot commented Feb 28, 2023

Backport to stable-4.6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4.6/d1dfb7bf7e6e3b899d4a36a2d2e70535e148b216/pr-1603

Backported as #1627

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-4.6 This PR should be backported to stable-4.6 (2.3)
Projects
None yet
3 participants