| from netaddr import IPAddress, IPNetwork |
| from django.db.models import F, Q |
| from planetstack.config import Config |
| from observer.openstacksyncstep import OpenStackSyncStep |
| from core.models.slice import Slice, SliceDeployments |
| from util.logger import Logger, logging |
| from observer.steps.sync_slice_deployments import * |
| logger = Logger(level=logging.INFO) |
| class SyncSlices(OpenStackSyncStep): |
| 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 |
| def delete_record(self, slice): |
| slice_deployment_deleter = SyncSliceDeployments().delete_record |
| for slice_deployment in SliceDeployments.objects.filter(slice=slice): |
| slice_deployment_deleter(slice_deployment) |
| logger.log_exc("Failed to delete slice_deployment %s" % slice_deployment) |