fix ui container not onboarded after service resources
Change-Id: I6e8c23c5c3c352d94c07422533b1d56c3f0ee457
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index dd1857d..163bb53 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -263,6 +263,10 @@
if "silent" in kwargs:
silent=silent or kwargs.pop("silent")
+ always_update_timestamp = False
+ if "always_update_timestamp" in kwargs:
+ always_update_timestamp = always_update_timestamp or kwargs.pop("always_update_timestamp")
+
# SMBAKER: if an object is trying to delete itself, or if the observer
# is updating an object's backend_* fields, then let it slip past the
# composite key check.
@@ -273,7 +277,7 @@
if not (field in ["backend_register", "backend_status", "deleted", "enacted", "updated"]):
ignore_composite_key_check=False
- if 'synchronizer' not in threading.current_thread().name:
+ if ('synchronizer' not in threading.current_thread().name) or always_update_timestamp:
self.updated = timezone.now()
# Transmit update via Redis
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 502f7a7..63432b3 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -85,10 +85,11 @@
def save(self, *args, **kwargs):
super(LoadableModule, self).save(*args, **kwargs)
- if self.xos:
- # force XOS to rebuild
- # XXX somewhat hackish XXX
- self.xos.save(update_fields=["updated"])
+# XXX handling this in the LoadableModuleResource syncstep instead
+# if self.xos:
+# # force XOS to rebuild
+# # XXX somewhat hackish XXX
+# self.xos.save(update_fields=["updated"])
def get_provides_list(self):
prov_list = []
diff --git a/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py b/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
index 59ae93f..a089bec 100644
--- a/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
+++ b/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
@@ -28,6 +28,11 @@
logger.info("Sync'ing ServiceControllerResource %s" % scr)
self.download_resource(scr)
+ if scr.loadable_module and scr.loadable_module.xos:
+ # Make sure the xos UI is resynced
+ xos = scr.loadable_module.xos
+ xos.save(update_fields=["updated"], always_update_timestamp=True)
+
def delete_record(self, m):
pass