blob: 59f32e6c947bb272067152f0065fbeb63b20da3b [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
3from planetstack.config import Config
4
5class SyncSites(OpenStackSyncStep):
6 provides=[Site]
Sapan Bhatia2ef36c82013-09-02 14:30:37 -04007 requested_interval=0
Sapan Bhatia24836f12013-08-27 10:16:05 -04008 def sync_record(self, site):
9 save_site = False
10 if not site.tenant_id:
11 tenant = self.driver.create_tenant(tenant_name=site.login_base,
12 description=site.name,
13 enabled=site.enabled)
14 site.tenant_id = tenant.id
15 save_site = True
16 # XXX - What's caller?
17 # self.driver.add_user_role(self.caller.kuser_id, tenant.id, 'admin')
18
19 # update the record
20 if site.id and site.tenant_id:
21 self.driver.update_tenant(site.tenant_id,
22 description=site.name,
23 enabled=site.enabled)
24
25 if (save_site):
26 site.save() #
27