Separated "provides" and "observes" declarations in sync steps. Provides is for dependency management and observes is for retrieving obejcts that have changed.
diff --git a/planetstack/openstack_observer/steps/sync_controller_images.py b/planetstack/openstack_observer/steps/sync_controller_images.py
index fa0cad1..e076d81 100644
--- a/planetstack/openstack_observer/steps/sync_controller_images.py
+++ b/planetstack/openstack_observer/steps/sync_controller_images.py
@@ -13,6 +13,7 @@
class SyncControllerImages(OpenStackSyncStep):
provides=[ControllerImages]
+ observes = ControllerImages
requested_interval=0
def fetch_pending(self, deleted):
diff --git a/planetstack/openstack_observer/steps/sync_controller_networks.py b/planetstack/openstack_observer/steps/sync_controller_networks.py
index 1071ef7..83cf8ea 100644
--- a/planetstack/openstack_observer/steps/sync_controller_networks.py
+++ b/planetstack/openstack_observer/steps/sync_controller_networks.py
@@ -11,11 +11,14 @@
from util.logger import Logger, logging
from observer.ansible import *
+import pdb
+
logger = Logger(level=logging.INFO)
class SyncControllerNetworks(OpenStackSyncStep):
requested_interval = 0
provides=[Network]
+ observes=ControllerNetwork
def alloc_subnet(self, uuid):
# 16 bits only
diff --git a/planetstack/openstack_observer/steps/sync_controller_site_privileges.py b/planetstack/openstack_observer/steps/sync_controller_site_privileges.py
index 89fa27c..0ea86e1 100644
--- a/planetstack/openstack_observer/steps/sync_controller_site_privileges.py
+++ b/planetstack/openstack_observer/steps/sync_controller_site_privileges.py
@@ -16,6 +16,7 @@
class SyncControllerSitePrivileges(OpenStackSyncStep):
provides=[SitePrivilege]
requested_interval=0
+ observes=ControllerSitePrivilege
def fetch_pending(self, deleted):
diff --git a/planetstack/openstack_observer/steps/sync_controller_sites.py b/planetstack/openstack_observer/steps/sync_controller_sites.py
index 2dc13da..f7905c9 100644
--- a/planetstack/openstack_observer/steps/sync_controller_sites.py
+++ b/planetstack/openstack_observer/steps/sync_controller_sites.py
@@ -9,13 +9,13 @@
class SyncControllerSites(OpenStackSyncStep):
requested_interval=0
provides=[Site]
+ observes=ControllerSite
def fetch_pending(self, deleted=False):
pending = super(OpenStackSyncStep, self).fetch_pending(deleted)
return pending.filter(controller__isnull=False)
def sync_record(self, controller_site):
-
template = os_template_env.get_template('sync_controller_sites.yaml')
tenant_fields = {'endpoint':controller_site.controller.auth_url,
'admin_user': controller_site.controller.admin_user,
diff --git a/planetstack/openstack_observer/steps/sync_controller_slice_privileges.py b/planetstack/openstack_observer/steps/sync_controller_slice_privileges.py
index 35d1b99..99000ea 100644
--- a/planetstack/openstack_observer/steps/sync_controller_slice_privileges.py
+++ b/planetstack/openstack_observer/steps/sync_controller_slice_privileges.py
@@ -16,6 +16,7 @@
class SyncControllerSlicePrivileges(OpenStackSyncStep):
provides=[SlicePrivilege]
requested_interval=0
+ observes=ControllerSlicePrivilege
def fetch_pending(self, deleted):
diff --git a/planetstack/openstack_observer/steps/sync_controller_slices.py b/planetstack/openstack_observer/steps/sync_controller_slices.py
index 9e47669..0c24ae1 100644
--- a/planetstack/openstack_observer/steps/sync_controller_slices.py
+++ b/planetstack/openstack_observer/steps/sync_controller_slices.py
@@ -16,6 +16,7 @@
class SyncControllerSlices(OpenStackSyncStep):
provides=[Slice]
requested_interval=0
+ observes=ControllerSlice
def fetch_pending(self, deleted):
if (deleted):
diff --git a/planetstack/openstack_observer/steps/sync_controller_users.py b/planetstack/openstack_observer/steps/sync_controller_users.py
index d7d79f7..08123fe 100644
--- a/planetstack/openstack_observer/steps/sync_controller_users.py
+++ b/planetstack/openstack_observer/steps/sync_controller_users.py
@@ -16,6 +16,7 @@
class SyncControllerUsers(OpenStackSyncStep):
provides=[User]
requested_interval=0
+ observes=ControllerUser
def fetch_pending(self, deleted):
diff --git a/planetstack/openstack_observer/steps/sync_slivers.py b/planetstack/openstack_observer/steps/sync_slivers.py
index 3989c16..9a25c19 100644
--- a/planetstack/openstack_observer/steps/sync_slivers.py
+++ b/planetstack/openstack_observer/steps/sync_slivers.py
@@ -19,6 +19,7 @@
class SyncSlivers(OpenStackSyncStep):
provides=[Sliver]
requested_interval=0
+ observes=Sliver
def get_userdata(self, sliver):
userdata = 'opencloud:\n slicename: "%s"\n hostname: "%s"\n' % (sliver.slice.name, sliver.node.name)
diff --git a/planetstack/openstack_observer/syncstep.py b/planetstack/openstack_observer/syncstep.py
index 85c03db..247d4c9 100644
--- a/planetstack/openstack_observer/syncstep.py
+++ b/planetstack/openstack_observer/syncstep.py
@@ -51,7 +51,7 @@
# This is the most common implementation of fetch_pending
# Steps should override it if they have their own logic
# for figuring out what objects are outstanding.
- main_obj = self.provides[0]
+ main_obj = self.observes
if (not deletion):
objs = main_obj.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
else: