blob: cbaf4909effe3abcf7b34d8600a128095051bb2e [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
3from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04004from observer.syncstep import SyncStep
Sapan Bhatia24836f12013-08-27 10:16:05 -04005
6class SyncExternalRoutes(SyncStep):
7 # XXX what does this provide?
Sapan Bhatia2ef36c82013-09-02 14:30:37 -04008 requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently
9
Sapan Bhatia04c94ad2013-09-02 18:00:28 -040010 def __init__(self):
11 pass
12
Sapan Bhatia24836f12013-08-27 10:16:05 -040013 def call(self):
Tony Mack387a73f2013-09-18 07:59:14 -040014 routes = self.driver.get_external_routes()
15 subnets = self.driver.shell.quantum.list_subnets()['subnets']
Sapan Bhatia04c94ad2013-09-02 18:00:28 -040016 for subnet in subnets:
17 try:
Tony Mack387a73f2013-09-18 07:59:14 -040018 self.driver.add_external_route(subnet, routes)
Sapan Bhatia04c94ad2013-09-02 18:00:28 -040019 except:
20 logger.log_exc("failed to add external route for subnet %s" % subnet)