diff options
author | Michael Elkins <melkins@tislabs.com> | 2013-09-19 21:02:10 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2013-09-19 21:02:10 +0000 |
commit | b2e2790a58cca9063e51a89fc6d913fb0f6f0511 (patch) | |
tree | 386c9215973e40a194f7845d6ca92531abcaa3d9 /rpkid | |
parent | b50f539b3af0136ce603f9165f07e05c0e9a85e9 (diff) |
garbage collect ROAPrefixV* objects when there are no associated ROAs
closes #620
svn path=/trunk/; revision=5499
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/rpki/gui/cacheview/util.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rpkid/rpki/gui/cacheview/util.py b/rpkid/rpki/gui/cacheview/util.py index fdb3e370..393e68a8 100644 --- a/rpkid/rpki/gui/cacheview/util.py +++ b/rpkid/rpki/gui/cacheview/util.py @@ -267,6 +267,11 @@ def process_cache(root, xml_file): # Delete all objects that have zero validation status elements. models.RepositoryObject.objects.annotate(num_statuses=django.db.models.Count('statuses')).filter(num_statuses=0).delete() + # ROAPrefixV* objects are M2M so they are not automatically deleted when + # their ROA object disappears + models.ROAPrefixV4.objects.annotate(num_roas=django.db.models.Count('roas')).filter(num_roas=0).delete() + models.ROAPrefixV6.objects.annotate(num_roas=django.db.models.Count('roas')).filter(num_roas=0).delete() + @transaction.commit_on_success def process_labels(xml_file): |