fix instance created with missing networks
Change-Id: Iac5593bdae99d4d7670874e38b8ea48362a31562
diff --git a/xos/synchronizer/steps/sync_instances.py b/xos/synchronizer/steps/sync_instances.py
index 92b621f..e172602 100644
--- a/xos/synchronizer/steps/sync_instances.py
+++ b/xos/synchronizer/steps/sync_instances.py
@@ -104,6 +104,10 @@
controller_networks = ControllerNetwork.objects.filter(network__in=networks,
controller=instance.node.site_deployment.controller)
+ for network in networks:
+ if not ControllerNetwork.objects.filter(network=network, controller=instance.node.site_deployment.controller).exists():
+ raise DeferredException("Instance %s Private Network %s lacks ControllerNetwork object" % (instance, network.name))
+
#controller_networks = self.sort_controller_networks(controller_networks)
for controller_network in controller_networks:
# Lenient exception - causes slow backoff