Bugfix in dropper.py, handle gracefully failure in cleanup

This commit is contained in:
Daniel Goldberg 2018-04-17 14:20:21 +03:00
parent cc4ad05be8
commit 558fa749ca
1 changed files with 20 additions and 17 deletions

View File

@ -133,6 +133,7 @@ class MonkeyDrops(object):
LOG.warn("Seems like monkey died too soon") LOG.warn("Seems like monkey died too soon")
def cleanup(self): def cleanup(self):
try:
if (self._config['source_path'].lower() != self._config['destination_path'].lower()) and \ if (self._config['source_path'].lower() != self._config['destination_path'].lower()) and \
os.path.exists(self._config['source_path']) and \ os.path.exists(self._config['source_path']) and \
WormConfiguration.dropper_try_move_first: WormConfiguration.dropper_try_move_first:
@ -152,3 +153,5 @@ class MonkeyDrops(object):
else: else:
LOG.debug("Dropper source file '%s' is marked for deletion on next boot", LOG.debug("Dropper source file '%s' is marked for deletion on next boot",
self._config['source_path']) self._config['source_path'])
except AttributeError:
LOG.error("Invalid configuration options. Failing")