Browse Source

Watchdog cleanup

Removing a function we don't use, audit_modified.
Make the file->function mapping a part of the engine.

Change-Id: Id656efb176340ccf9def59f1547e3f6f4ddb79b3
pran1990 4 years ago
parent
commit
81cd48dacc
1 changed files with 5 additions and 8 deletions
  1. 5
    8
      entropy/engine.py

+ 5
- 8
entropy/engine.py View File

@@ -59,6 +59,8 @@ class Engine(object):
59 59
         self.running_repairs = []
60 60
         self.futures = []
61 61
         self.run_queue = collections.deque()
62
+        # Private variables
63
+        self._watchdog_event_fn = {self.repair_cfg: self.repair_modified}
62 64
         LOG.info('Created engine obj %s', self.name)
63 65
 
64 66
     # TODO(praneshp): Move to utils?
@@ -171,19 +173,14 @@ class Engine(object):
171 173
             LOG.exception("Could not run serializer for %s at %s",
172 174
                           self.name, current_time)
173 175
 
174
-    # TODO(praneshp): For now, only addition of scripts. Handle deletion later
175
-    def audit_modified(self):
176
-        LOG.info('Audit configuration changed')
177
-
178 176
     def repair_modified(self):
179 177
         LOG.info('Repair configuration changed')
180 178
         self.futures.append(self.start_react_scripts())
181 179
 
182 180
     def start_watchdog(self, dir_to_watch):
183
-        event_fn = {self.audit_cfg: self.audit_modified,
184
-                    self.repair_cfg: self.repair_modified}
185
-        LOG.debug(event_fn)
186
-        return utils.watch_dir_for_change(dir_to_watch, event_fn)
181
+        LOG.debug('Watchdog mapping is: ', self._watchdog_event_fn)
182
+        return utils.watch_dir_for_change(dir_to_watch,
183
+                                          self._watchdog_event_fn)
187 184
 
188 185
     def setup_audit(self, execution_time, audit_list):
189 186
         try:

Loading…
Cancel
Save