blob: fd42f4ef5b2cba49f305ad88ca20ee6bdd10664f [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
Tony Mack66646d52013-09-24 21:47:12 -040015 def fetch_pending(self):
16 return Network.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
17
Andy Bavier49801322013-11-18 20:08:05 -050018 def sync_record(self, network):
Tony Mack97402602014-04-10 12:24:45 -040019 network.save()
Sapan Bhatia24836f12013-08-27 10:16:05 -040020