CORD-1243 move exampleservice model policies to model policy framework
Change-Id: I3404922c6ecbb7d0463b0315b3d7b433016c3444
diff --git a/xos/attic/exampletenant_bottom.py b/xos/attic/exampletenant_bottom.py
deleted file mode 100644
index 7ac737e..0000000
--- a/xos/attic/exampletenant_bottom.py
+++ /dev/null
@@ -1,8 +0,0 @@
-def model_policy_exampletenant(pk):
- with transaction.atomic():
- tenant = ExampleTenant.objects.select_for_update().filter(pk=pk)
- if not tenant:
- return
- tenant = tenant[0]
- tenant.manage_container()
-
diff --git a/xos/attic/exampletenant_model.py b/xos/attic/exampletenant_model.py
deleted file mode 100644
index 9eb1f86..0000000
--- a/xos/attic/exampletenant_model.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def __init__(self, *args, **kwargs):
- exampleservice = ExampleService.objects.all()
- if exampleservice:
- self._meta.get_field('provider_service').default = exampleservice[0].id
- super(ExampleTenant, self).__init__(*args, **kwargs)
-
-def save(self, *args, **kwargs):
- super(ExampleTenant, self).save(*args, **kwargs)
- model_policy_exampletenant(self.pk)
-
-def delete(self, *args, **kwargs):
- self.cleanup_container()
- super(ExampleTenant, self).delete(*args, **kwargs)
-
diff --git a/xos/synchronizer/exampleservice_config.yaml b/xos/synchronizer/exampleservice_config.yaml
index cda8fb9..38f9f21 100644
--- a/xos/synchronizer/exampleservice_config.yaml
+++ b/xos/synchronizer/exampleservice_config.yaml
@@ -9,4 +9,5 @@
- ServiceMonitoringAgentInfo
dependency_graph: "/opt/xos/synchronizers/exampleservice/model-deps"
steps_dir: "/opt/xos/synchronizers/exampleservice/steps"
-sys_dir: "/opt/xos/synchronizers/exampleservice/sys"
\ No newline at end of file
+sys_dir: "/opt/xos/synchronizers/exampleservice/sys"
+model_policies_dir: "/opt/xos/synchronizers/exampleservice/model_policies"
diff --git a/xos/synchronizer/model_policies/model_policy_exampletenant.py b/xos/synchronizer/model_policies/model_policy_exampletenant.py
new file mode 100644
index 0000000..5650ae4
--- /dev/null
+++ b/xos/synchronizer/model_policies/model_policy_exampletenant.py
@@ -0,0 +1,5 @@
+from synchronizers.new_base.modelaccessor import *
+from synchronizers.new_base.model_policies.model_policy_tenantwithcontainer import TenantWithContainerPolicy
+
+class ExampleTenantPolicy(TenantWithContainerPolicy):
+ model_name = "ExampleTenant"