From 81cd48daccbabcc8ad1f7f2044c2f4a1c43772af Mon Sep 17 00:00:00 2001 From: pran1990 Date: Fri, 30 May 2014 16:05:22 -0700 Subject: [PATCH] Watchdog cleanup Removing a function we don't use, audit_modified. Make the file->function mapping a part of the engine. Change-Id: Id656efb176340ccf9def59f1547e3f6f4ddb79b3 --- entropy/engine.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/entropy/engine.py b/entropy/engine.py index 8482de2..f4ac965 100644 --- a/entropy/engine.py +++ b/entropy/engine.py @@ -59,6 +59,8 @@ class Engine(object): self.running_repairs = [] self.futures = [] self.run_queue = collections.deque() + # Private variables + self._watchdog_event_fn = {self.repair_cfg: self.repair_modified} LOG.info('Created engine obj %s', self.name) # TODO(praneshp): Move to utils? @@ -171,19 +173,14 @@ class Engine(object): LOG.exception("Could not run serializer for %s at %s", self.name, current_time) - # TODO(praneshp): For now, only addition of scripts. Handle deletion later - def audit_modified(self): - LOG.info('Audit configuration changed') - def repair_modified(self): LOG.info('Repair configuration changed') self.futures.append(self.start_react_scripts()) def start_watchdog(self, dir_to_watch): - event_fn = {self.audit_cfg: self.audit_modified, - self.repair_cfg: self.repair_modified} - LOG.debug(event_fn) - return utils.watch_dir_for_change(dir_to_watch, event_fn) + LOG.debug('Watchdog mapping is: ', self._watchdog_event_fn) + return utils.watch_dir_for_change(dir_to_watch, + self._watchdog_event_fn) def setup_audit(self, execution_time, audit_list): try: