blob: 4672878de97e0e20924c4ce45969a35439d1c5d4 [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
6from core.models.site import Site
Sapan Bhatia64a79632014-08-19 02:58:04 -04007from observer.steps.sync_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):
Sapan Bhatia3d872e52014-11-11 21:41:12 -050017 site_deployments = SiteDeployment.objects.filter(site=site)
18 site_deployment_deleter = SyncSiteDeployment().delete_record
Sapan Bhatia18c64cf2014-07-23 09:05:38 -040019 for site_deployment in site_deployments:
Sapan Bhatia64a79632014-08-19 02:58:04 -040020 site_deployment_deleter(site_deployment)