CORD-1250 Update to new Service/Tenancy models
Change-Id: Ib64b8b627bcf7b64bc28838005e3dd70c0800fde
diff --git a/xos/synchronizer/steps/sync_exampletenant.py b/xos/synchronizer/steps/sync_exampletenant.py
index 47c045f..e36a06a 100644
--- a/xos/synchronizer/steps/sync_exampletenant.py
+++ b/xos/synchronizer/steps/sync_exampletenant.py
@@ -27,10 +27,10 @@
super(SyncExampleTenant, self).__init__(*args, **kwargs)
def get_exampleservice(self, o):
- if not o.provider_service:
+ if not o.owner:
return None
- exampleservice = ExampleService.objects.filter(id=o.provider_service.id)
+ exampleservice = ExampleService.objects.filter(id=o.owner.id)
if not exampleservice:
return None
@@ -62,7 +62,7 @@
objs = ExampleTenant.objects.all()
for obj in objs:
- if obj.provider_service.id != monitoring_agent_info.service.id:
+ if obj.owner.id != monitoring_agent_info.service.id:
logger.info("handle watch notifications for service monitoring agent info...ignoring because service attribute in monitoring agent info:%s is not matching" % (monitoring_agent_info))
return
diff --git a/xos/tosca/resources/exampletenant.py b/xos/tosca/resources/exampletenant.py
index 2675189..1cb7b1f 100644
--- a/xos/tosca/resources/exampletenant.py
+++ b/xos/tosca/resources/exampletenant.py
@@ -1,5 +1,5 @@
from xosresource import XOSResource
-from core.models import Tenant, Service
+from core.models import Service
from services.exampleservice.models import ExampleTenant, SERVICE_NAME as EXAMPLETENANT_KIND
class XOSExampleTenant(XOSResource):
@@ -14,13 +14,13 @@
# ExampleTenant must always have a provider_service
provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=True)
if provider_name:
- args["provider_service"] = self.get_xos_object(Service, throw_exception=True, name=provider_name)
+ args["owner"] = self.get_xos_object(Service, throw_exception=True, name=provider_name)
return args
def get_existing_objs(self):
args = self.get_xos_args(throw_exception=False)
- return ExampleTenant.objects.filter(provider_service=args["provider_service"], service_specific_id=args["service_specific_id"])
+ return ExampleTenant.objects.filter(owner=args["owner"], service_specific_id=args["service_specific_id"])
return []
def can_delete(self, obj):