[CORD-2031] Migration of vHSS service to 4.1
Change-Id: Iaab41b6cbfa8fb5036ae04bb9f30f3a55bcdbd1e
(cherry picked from commit c8c6ddd43f0657c2146ac4a8b5ff03141b6375db)
diff --git a/xos/tosca/resources/vhsstenant.py b/xos/tosca/resources/vhsstenant.py
index 074c423..2d572c0 100644
--- a/xos/tosca/resources/vhsstenant.py
+++ b/xos/tosca/resources/vhsstenant.py
@@ -13,29 +13,34 @@
# limitations under the License.
from xosresource import XOSResource
-from core.models import Tenant, Service
+from core.models import ServiceInstance, Service
from services.vhss.models import VHSSTenant
class XOSVHSSTenant(XOSResource):
provides = "tosca.nodes.VHSSTenant"
xos_model = VHSSTenant
- name_field = "service_specific_id"
+ name_field = None
copyin_props = ()
def get_xos_args(self, throw_exception=True):
args = super(XOSVHSSTenant, self).get_xos_args()
- provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=True)
+ provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=throw_exception)
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=throw_exception, name=provider_name)
return args
def get_existing_objs(self):
args = self.get_xos_args(throw_exception=False)
- return VHSSTenant.get_tenant_objects().filter(provider_service=args["provider_service"], service_specific_id=args["service_specific_id"])
+ owner = args.get("provider", None)
+ if owner:
+ return [ self.get_xos_object(owner=owner) ]
return []
+ def postprocess(self, obj):
+ pass
+
def can_delete(self, obj):
return super(XOSVHSSTenant, self).can_delete(obj)