Link watches to callbacks
Callbacks must ultimately be triggered when a property
is updated by a watch. Add that support.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I20130a11c19ddcf2c4ae45800f2068b31950bcd6
diff --git a/src/pdmgen.py b/src/pdmgen.py
index 4a958e1..54790bb 100755
--- a/src/pdmgen.py
+++ b/src/pdmgen.py
@@ -410,8 +410,21 @@
'''Handle the property watch config file directive.'''
def __init__(self, *a, **kw):
+ self.callback = kw.pop('callback', None)
super(PropertyWatch, self).__init__(**kw)
+ def setup(self, objs):
+ '''Resolve optional callback.'''
+
+ if self.callback:
+ self.callback = get_index(
+ objs,
+ 'callback',
+ self.callback,
+ config=self.configfile)
+
+ super(PropertyWatch, self).setup(objs)
+
class Callback(HasPropertyIndex):
'''Interface and common logic for callbacks.'''