Fixed several bugs that were triggering the issues we saw on portal.
Also, fixed a bug that blocked controller disabling.
diff --git a/xos/core/models/instance.py b/xos/core/models/instance.py
index 62a86c4..684fcdc 100644
--- a/xos/core/models/instance.py
+++ b/xos/core/models/instance.py
@@ -101,6 +101,9 @@
volumes = models.TextField(null=True, blank=True, help_text="Comma-separated list of directories to expose to parent context")
parent = models.ForeignKey("Instance", null=True, blank=True, help_text="Parent Instance for containers nested inside of VMs")
+ def get_controller (self):
+ return node.site_deployment.controller
+
def __unicode__(self):
if self.name and Slice.objects.filter(id=self.slice_id) and (self.name != self.slice.name):
# NOTE: The weird check on self.slice_id was due to a problem when
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 0822bf5..99acc15 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -224,6 +224,9 @@
self._initial = self._dict # for PlModelMixIn
self.silent = False
+ def get_controller(self):
+ return self.controller
+
def can_update(self, user):
return user.can_update_root()
diff --git a/xos/core/models/site.py b/xos/core/models/site.py
index 1bdef36..b98c40a 100644
--- a/xos/core/models/site.py
+++ b/xos/core/models/site.py
@@ -310,6 +310,11 @@
site = models.ForeignKey(Site,related_name='controllersite')
controller = models.ForeignKey(Controller, null=True, blank=True, related_name='controllersite')
tenant_id = StrippedCharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone tenant id")
+
+ def delete(self, *args, **kwds):
+ pdb.set_trace()
+ super(ControllerSite, self).delete(*args, **kwds)
+
class Meta:
unique_together = ('site', 'controller')
diff --git a/xos/synchronizers/base/syncstep.py b/xos/synchronizers/base/syncstep.py
index bdab8f3..54c4b89 100644
--- a/xos/synchronizers/base/syncstep.py
+++ b/xos/synchronizers/base/syncstep.py
@@ -142,10 +142,10 @@
def sync_record(self, o):
try:
controller = o.get_controller()
- controller_register = json.loads(o.node.site_deployment.controller.backend_register)
+ controller_register = json.loads(controller.backend_register)
if (controller_register.get('disabled',False)):
- raise InnocuousException('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
+ raise InnocuousException('Controller %s is disabled'%controller.name)
except AttributeError:
pass
@@ -249,7 +249,7 @@
except:
error = '%s'%str_e
- if isinstance(e, InnocuousException) and not force_error:
+ if isinstance(e, InnocuousException):
o.backend_status = '1 - %s'%error
else:
o.backend_status = '2 - %s'%error
diff --git a/xos/synchronizers/openstack/event_loop.py b/xos/synchronizers/openstack/event_loop.py
index 6cfc9f6..3a14511 100644
--- a/xos/synchronizers/openstack/event_loop.py
+++ b/xos/synchronizers/openstack/event_loop.py
@@ -23,8 +23,8 @@
#from timeout import timeout
from xos.config import Config, XOS_DIR
from synchronizers.base.steps import *
-from syncstep import SyncStep
-from toposort import toposort
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.toposort import toposort
from synchronizers.base.error_mapper import *
from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
from synchronizers.base.steps.sync_object import SyncObject
diff --git a/xos/synchronizers/openstack/openstacksyncstep.py b/xos/synchronizers/openstack/openstacksyncstep.py
index cc568f8..46056cf 100644
--- a/xos/synchronizers/openstack/openstacksyncstep.py
+++ b/xos/synchronizers/openstack/openstacksyncstep.py
@@ -1,6 +1,6 @@
import os
import base64
-from syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
class OpenStackSyncStep(SyncStep):
""" XOS Sync step for copying data to OpenStack
diff --git a/xos/synchronizers/openstack/syncstep.py b/xos/synchronizers/openstack/syncstep.py
index bdab8f3..d1639b4 100644
--- a/xos/synchronizers/openstack/syncstep.py
+++ b/xos/synchronizers/openstack/syncstep.py
@@ -142,10 +142,10 @@
def sync_record(self, o):
try:
controller = o.get_controller()
- controller_register = json.loads(o.node.site_deployment.controller.backend_register)
+ controller_register = json.loads(controller.backend_register)
if (controller_register.get('disabled',False)):
- raise InnocuousException('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
+ raise InnocuousException('Controller %s is disabled'%controller.name)
except AttributeError:
pass