cbaf4909effe3abcf7b34d8600a128095051bb2e
[plstackapi.git] / planetstack / observer / steps / sync_external_routes.py
1 import os
2 import base64
3 from planetstack.config import Config
4 from observer.syncstep import SyncStep
5
6 class SyncExternalRoutes(SyncStep):
7         # XXX what does this provide?
8         requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently
9
10         def __init__(self):
11                 pass
12
13         def call(self):
14                 routes = self.driver.get_external_routes()
15                 subnets = self.driver.shell.quantum.list_subnets()['subnets']
16                 for subnet in subnets:
17                         try:
18                                 self.driver.add_external_route(subnet, routes)
19                         except:
20                                 logger.log_exc("failed to add external route for subnet %s" % subnet)