Sync refactored into abstract steps
diff --git a/planetstack/observer/steps/sync_sites.py b/planetstack/observer/steps/sync_sites.py
new file mode 100644
index 0000000..5d7cc30
--- /dev/null
+++ b/planetstack/observer/steps/sync_sites.py
@@ -0,0 +1,26 @@
+import os
+import base64
+from planetstack.config import Config
+
+class SyncSites(OpenStackSyncStep):
+ provides=[Site]
+ def sync_record(self, site):
+ save_site = False
+ if not site.tenant_id:
+ tenant = self.driver.create_tenant(tenant_name=site.login_base,
+ description=site.name,
+ enabled=site.enabled)
+ site.tenant_id = tenant.id
+ save_site = True
+ # XXX - What's caller?
+ # self.driver.add_user_role(self.caller.kuser_id, tenant.id, 'admin')
+
+ # update the record
+ if site.id and site.tenant_id:
+ self.driver.update_tenant(site.tenant_id,
+ description=site.name,
+ enabled=site.enabled)
+
+ if (save_site):
+ site.save() #
+