[SEBA-690] Propagating changes to the RCORDSubscriber to the ServiceInstances chain
Change-Id: I81e4fcfca22845ba781c2e99f907c599d8306249
diff --git a/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py b/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
index 38a13c3..2185fdf 100644
--- a/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
+++ b/xos/synchronizer/model_policies/model_policy_rcordsubscriber.py
@@ -28,7 +28,7 @@
chain = si.subscribed_links.all()
# Already has a chain
- if si.status != "enabled" and len(chain) > 0:
+ if si.status != "enabled" and len(chain) > 0:
# delete chain
self.logger.debug("MODEL_POLICY: deleting RCORDSubscriber chain from %s" % si.id, status=si.status)
for link in chain:
@@ -55,6 +55,9 @@
valid_provider_service_instance = provider_service.validate_links(si)
if not valid_provider_service_instance:
provider_service.acquire_service_instance(si)
+ else:
+ for si in valid_provider_service_instance:
+ si.save(always_update_timestamp=True)
def handle_delete(self, si):
pass
diff --git a/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py b/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
index 374e9be..ed2c3f1 100644
--- a/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
+++ b/xos/synchronizer/model_policies/test_model_policy_rcordsubscriber.py
@@ -86,7 +86,7 @@
next_si = Mock()
link = Mock()
- link.provider_service.validate_links = Mock(return_value=next_si)
+ link.provider_service.validate_links = Mock(return_value=[next_si])
link.provider_service.acquire_service_instance = Mock()
link.provider_service.leaf_model = link.provider_service