Slice deleter, refactored
diff --git a/planetstack/openstack_observer/steps/sync_slices.py b/planetstack/openstack_observer/steps/sync_slices.py
index 6cf0772..c0b8abe 100644
--- a/planetstack/openstack_observer/steps/sync_slices.py
+++ b/planetstack/openstack_observer/steps/sync_slices.py
@@ -13,11 +13,17 @@
provides=[Slice]
requested_interval=0
- def fetch_pending(self):
- return Slice.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
-
def sync_record(self, slice):
for slice_deployment in SliceDeployments.objects.filter(slice=slice):
# bump the 'updated' timestamp and trigger observer to update
# slice across all deployments
slice_deployment.save()
+
+ def delete_record(self, slice):
+ slice_deployment_deleter = SliceDeploymentDeleter()
+ for slice_deployment in SliceDeployments.objects.filter(slice=slice):
+ try:
+ slice_deployment_deleter(slice_deployment.id)
+ except Exception,e:
+ logger.log_exc("Failed to delete slice_deployment %s" % slice_deployment)
+ raise e