Bug 12818 - Remove orphaned imported layers when project is deleted
Summary: Remove orphaned imported layers when project is deleted
Status: RESOLVED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.6 M3
Assignee: David Reyna
QA Contact: Toaster default assignee
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2018-06-28 00:31 UTC by David Reyna
Modified: 2018-08-26 05:54 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Reyna 2018-06-28 00:31:39 UTC
Imported layers are indirectly attached to projects via a Layer_Version record.

When a delete is performed on a project, Django will perform the deep delete on all related records, but it cannot find these related imported layer objects. This results in orphaned layers that can block re-adding that layer subsequently (because names must be unique).

The project delete method needs to capture those layers to delete before the project is deleted, and then explicitly delete then (as long as they are not referenced by other projects).
Comment 1 David Reyna 2018-08-26 05:54:42 UTC
commit 08fbdc02e32d715ae94e3b9603fb3ec8351c8fd3