Worked around an authentication problem
[plstackapi.git] / planetstack / openstack_observer / steps / sync_external_routes.py
1 import os
2 import base64
3 from planetstack.config import Config
4 from observer.openstacksyncstep import OpenStackSyncStep
5 from core.models.site import Deployment
6
7 class SyncExternalRoutes(OpenStackSyncStep):
8     # XXX what does this provide?
9     provides=[]
10     requested_interval = 86400 # This step is slow like a pig. Let's run it infrequently
11
12     def call(self, **args):
13         deployments = Deployment.objects.all()
14         self.driver = self.driver.admin_driver(deployment=deployments[0],tenant='admin')
15         routes = self.driver.get_external_routes()
16         subnets = self.driver.shell.quantum.list_subnets()['subnets']
17         for subnet in subnets:
18             try:
19                 self.driver.add_external_route(subnet, routes)
20             except:
21                 logger.log_exc("failed to add external route for subnet %s" % subnet)