Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 1 | import os |
| 2 | import base64 |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 3 | from xos.config import Config |
Scott Baker | 8b75e85 | 2016-08-16 15:04:59 -0700 | [diff] [blame] | 4 | from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 5 | from xos.logger import observer_logger as logger |
Scott Baker | af599eb | 2017-03-21 12:43:26 -0700 | [diff] [blame] | 6 | from synchronizers.new_base.modelaccessor import * |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 7 | |
| 8 | class SyncRoles(OpenStackSyncStep): |
| 9 | provides=[Role] |
| 10 | requested_interval=0 |
| 11 | observes=[SiteRole,SliceRole,ControllerRole] |
| 12 | |
| 13 | def sync_record(self, role): |
| 14 | if not role.enacted: |
| 15 | controllers = Controller.objects.all() |
| 16 | for controller in controllers: |
| 17 | driver = self.driver.admin_driver(controller=controller) |
| 18 | driver.create_role(role.role) |
| 19 | role.save() |
| 20 | |