Merge "Watchdog cleanup"
This commit is contained in:
commit
286d0e18f0
|
@ -59,6 +59,8 @@ class Engine(object):
|
||||||
self.running_repairs = []
|
self.running_repairs = []
|
||||||
self.futures = []
|
self.futures = []
|
||||||
self.run_queue = collections.deque()
|
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)
|
LOG.info('Created engine obj %s', self.name)
|
||||||
|
|
||||||
# TODO(praneshp): Move to utils?
|
# TODO(praneshp): Move to utils?
|
||||||
|
@ -171,19 +173,14 @@ class Engine(object):
|
||||||
LOG.exception("Could not run serializer for %s at %s",
|
LOG.exception("Could not run serializer for %s at %s",
|
||||||
self.name, current_time)
|
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):
|
def repair_modified(self):
|
||||||
LOG.info('Repair configuration changed')
|
LOG.info('Repair configuration changed')
|
||||||
self.futures.extend(self.start_react_scripts())
|
self.futures.extend(self.start_react_scripts())
|
||||||
|
|
||||||
def start_watchdog(self, dir_to_watch):
|
def start_watchdog(self, dir_to_watch):
|
||||||
event_fn = {self.audit_cfg: self.audit_modified,
|
LOG.debug('Watchdog mapping is: ', self._watchdog_event_fn)
|
||||||
self.repair_cfg: self.repair_modified}
|
return utils.watch_dir_for_change(dir_to_watch,
|
||||||
LOG.debug(event_fn)
|
self._watchdog_event_fn)
|
||||||
return utils.watch_dir_for_change(dir_to_watch, event_fn)
|
|
||||||
|
|
||||||
def setup_audit(self, execution_time, audit_list):
|
def setup_audit(self, execution_time, audit_list):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue