blob: 418b4eafa902104d85fd3aef82125342168705dd [file] [log] [blame]
Scott Bakerb63ea792016-08-11 10:24:48 -07001import os
2import base64
3from django.db.models import F, Q
4from xos.config import Config
Scott Baker8b75e852016-08-16 15:04:59 -07005from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
Scott Bakerb63ea792016-08-11 10:24:48 -07006from core.models.role import Role
7from core.models.site import SiteRole, Controller, ControllerRole
8from core.models.slice import SliceRole
9from xos.logger import observer_logger as logger
10
11class SyncRoles(OpenStackSyncStep):
12 provides=[Role]
13 requested_interval=0
14 observes=[SiteRole,SliceRole,ControllerRole]
15
16 def sync_record(self, role):
17 if not role.enacted:
18 controllers = Controller.objects.all()
19 for controller in controllers:
20 driver = self.driver.admin_driver(controller=controller)
21 driver.create_role(role.role)
22 role.save()
23