CORD-665 xos ui container should be rebuilt on volume mount change
Change-Id: I93264740b3e0e3bce641708523cb347fcf9c3eaa
diff --git a/xos/core/admin.py b/xos/core/admin.py
index 109150f..164cbb4 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -1132,6 +1132,12 @@
('resources', 'Resources'),
)
+class XOSVolumeInline(XOSTabularInline):
+ model = XOSVolume
+ extra = 0
+ suit_classes = 'suit-tab suit-tab-volumes'
+ fields = ['container_path', 'host_path', 'read_only']
+
class XosModelAdmin(XOSBaseAdmin):
list_display = ("backend_status_icon", "name",)
list_display_links = ('backend_status_icon', 'name',)
@@ -1139,12 +1145,13 @@
"source_ui_image", "extra_hosts", "no_start"]
fieldsets = [
(None, {'fields': fieldList, 'classes': ['suit-tab suit-tab-general']})]
- inlines = []
+ inlines = [XOSVolumeInline]
readonly_fields = ('backend_status_text', )
user_readonly_fields = fieldList
suit_form_tabs = (('general', 'XOS Details'),
+ ('volumes', 'Volume Mounts'),
)
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 18d2c38..f9f16ec 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -87,9 +87,9 @@
# This is necessary, as the XOS syncstep handles rerunning the docker-
# compose.
+ # TODO: Update synchronizer and replace with watcher functionality
if self.xos:
# force XOS to rebuild
- # XXX somewhat hackish XXX
self.xos.save(update_fields=["updated"])
def get_provides_list(self):
diff --git a/xos/core/models/xosmodel.py b/xos/core/models/xosmodel.py
index e1ff93b..d5c2f5e 100644
--- a/xos/core/models/xosmodel.py
+++ b/xos/core/models/xosmodel.py
@@ -51,4 +51,14 @@
def __unicode__(self): return u'%s' % (self.container_path)
+ def save(self, *args, **kwargs):
+ super(XOSVolume, self).save(*args, **kwargs)
+
+ # This is necessary, as the XOS syncstep handles rerunning the docker-
+ # compose.
+ # TODO: Update onboarding synchronizer and replace this with watcher functionality
+ if self.xos:
+ # force XOS to rebuild
+ self.xos.save(update_fields=["updated"])
+
diff --git a/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py b/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
index 238b149..b9a8dfb 100644
--- a/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
+++ b/xos/synchronizers/onboarding/steps/sync_servicecontrollerresource.py
@@ -39,6 +39,9 @@
# Make sure the openstack controller is restarted. This is necessary
# as the OpenStack controller is the only one that handles model
# policies.
+ #
+ # Note: Expect to resolve this dependence as part of XOS refactoring.
+ #
os_scr = ServiceController.objects.filter(name="openstack")
if os_scr:
os_scr = os_scr[0]