CORD-1913: Restore execution of custom service save() methods in attics
Change-Id: I9d585d7da886d8a2c87df4687912c62ef71a412f
(cherry picked from commit aa9a696ca571289104fdb9bc4362d5b7f9303051)
diff --git a/lib/xos-genx/xosgenx/targets/service.xtarget b/lib/xos-genx/xosgenx/targets/service.xtarget
index 7b90aea..69aa81c 100644
--- a/lib/xos-genx/xosgenx/targets/service.xtarget
+++ b/lib/xos-genx/xosgenx/targets/service.xtarget
@@ -64,15 +64,17 @@
if not self.leaf_model_name:
self.leaf_model_name = "{{ m.name }}"
- try:
- self.__xos_save_base(*args, **kwds)
- except AttributeError:
- pass
-
{% for policy,error in xproto_validations(m.options) %}
policy_{{policy}}_validator(self, None)
{% endfor %}
- super({{ m.name }}{{ legacy_tag }}, self).save(*args, **kwds)
+
+ try:
+ base_save_in_attic = self.__xos_save_base(*args, **kwds)
+ except AttributeError:
+ base_save_in_attic = False
+
+ if not base_save_in_attic:
+ super({{ m.name }}{{ legacy_tag }}, self).save(*args, **kwds)
def can_access(self, ctx):
{% if m.policy %}
diff --git a/xos/core/models/attic/serviceinstancelink_model.py b/xos/core/models/attic/serviceinstancelink_model.py
index 0d33dcb..bf6dfbd 100644
--- a/xos/core/models/attic/serviceinstancelink_model.py
+++ b/xos/core/models/attic/serviceinstancelink_model.py
@@ -14,13 +14,12 @@
# limitations under the License.
-def save(self, *args, **kwargs):
+def __xos_save_base(self, *args, **kwargs):
subCount = sum([1 for e in [self.subscriber_service, self.subscriber_service_instance, self.subscriber_network] if e is not None])
if (subCount > 1):
raise XOSConflictingField(
"Only one of subscriber_service, subscriber_service_instance, subscriber_network should be set")
- super(ServiceInstanceLink, self).save(*args, **kwargs)
def delete(self, *args, **kwargs):
provider_service_instance = self.provider_service_instance