git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a5593a2
)
Provide default implementation of fetch_pending to remove redundant code
author
Sapan Bhatia
<gwsapan@gmail.com>
Wed, 23 Jul 2014 12:59:30 +0000
(08:59 -0400)
committer
Sapan Bhatia
<gwsapan@gmail.com>
Wed, 23 Jul 2014 20:25:15 +0000
(16:25 -0400)
from steps.
planetstack/openstack_observer/syncstep.py
patch
|
blob
|
history
diff --git
a/planetstack/openstack_observer/syncstep.py
b/planetstack/openstack_observer/syncstep.py
index
fc0cb0b
..
dcfea7d
100644
(file)
--- a/
planetstack/openstack_observer/syncstep.py
+++ b/
planetstack/openstack_observer/syncstep.py
@@
-44,7
+44,16
@@
class SyncStep:
return
def fetch_pending(self, deletion=False):
return
def fetch_pending(self, deletion=False):
- return []
+ # 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]
+ if (not deleted):
+ objs = main_obj.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ else:
+ objs = main_obj.deleted_objects.all()
+
+ return objs
#return Sliver.objects.filter(ip=None)
def check_dependencies(self, obj, failed):
#return Sliver.objects.filter(ip=None)
def check_dependencies(self, obj, failed):