blob: 84257f72670ebb9f732a1e8f9a7ba649544de601 [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.network import *
Andy Bavier49801322013-11-18 20:08:05 -05007from util.logger import Logger, logging
8
9logger = Logger(level=logging.INFO)
Sapan Bhatia24836f12013-08-27 10:16:05 -040010
11class SyncNetworks(OpenStackSyncStep):
Tony Mackce79de02013-09-24 10:12:33 -040012 provides=[Network]
13 requested_interval = 0
Sapan Bhatia24836f12013-08-27 10:16:05 -040014
Andy Bavier49801322013-11-18 20:08:05 -050015 def sync_record(self, network):
Tony Mack97402602014-04-10 12:24:45 -040016 network.save()
Sapan Bhatia24836f12013-08-27 10:16:05 -040017
Sapan Bhatiaa5593a22014-07-23 08:51:18 -040018 def delete_record(self, network):
19 network_deployment_deleter = NetworkDeploymentDeleter()
20 for network_deployment in NetworkDeployments.objects.filter(network=network):
21 try:
22 network_deployment_deleter(network_deployment.id)
23 except Exeption,e:
24 logger.log_exc("Failed to delete network deployment %s" % network_deployment)
25 raise e