diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-05-22 21:11:09 -0400 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-06-19 16:26:48 -0400 |
commit | fccdc39fdf8f97ef4bf3de3b8ddcae28fef4bc8e (patch) | |
tree | 734c68fb96a00f64783f846e5a22eda1138ffe21 /src/pdmgen.py | |
parent | b97bfff73e44e53571f8a00b80ec947496930d7b (diff) | |
download | phosphor-dbus-monitor-fccdc39fdf8f97ef4bf3de3b8ddcae28fef4bc8e.tar.gz phosphor-dbus-monitor-fccdc39fdf8f97ef4bf3de3b8ddcae28fef4bc8e.zip |
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
Diffstat (limited to 'src/pdmgen.py')
-rwxr-xr-x | src/pdmgen.py | 13 |
1 files changed, 13 insertions, 0 deletions
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 @@ class PropertyWatch(HasPropertyIndex): '''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.''' |