blob: ea7df7ec6cd8a09bc41f76ab80ac5a9395afac05 [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
Tony Mackae7f30c2013-09-25 12:46:50 -04003from django.db.models import F, Q
Sapan Bhatia24836f12013-08-27 10:16:05 -04004from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04005from observer.openstacksyncstep import OpenStackSyncStep
Tony Mackb469d242015-01-03 19:37:39 -05006from core.models.site import Site, SiteDeployments, SiteDeployments
Tony Mack528d4222014-12-05 17:13:08 -05007from observer.steps.sync_controller_site_deployments import *
Sapan Bhatia24836f12013-08-27 10:16:05 -04008
9class SyncSites(OpenStackSyncStep):
Tony Mackdacfb982013-09-24 21:57:16 -040010 provides=[Site]
11 requested_interval=0
Tony Mack66646d52013-09-24 21:47:12 -040012
Tony Mackdacfb982013-09-24 21:57:16 -040013 def sync_record(self, site):
Tony Macke4be32f2014-03-11 20:45:25 -040014 site.save()
Sapan Bhatia24836f12013-08-27 10:16:05 -040015
Sapan Bhatia18c64cf2014-07-23 09:05:38 -040016 def delete_record(self, site):
Tony Mack528d4222014-12-05 17:13:08 -050017 # delete associated controllers site deployments
Tony Mack528d4222014-12-05 17:13:08 -050018 site_deployments = SiteDeployments.objects.filter(site=site)
Tony Mackb469d242015-01-03 19:37:39 -050019 site_deploy_deleter = SyncControllerSiteDeployments().delete_record
Tony Mack528d4222014-12-05 17:13:08 -050020 for site_deployment in site_deployments:
Tony Mackb469d242015-01-03 19:37:39 -050021 site_deployment_deleter(site_deployment)
22
Tony Mack528d4222014-12-05 17:13:08 -050023
24
25