Skip to content
Snippets Groups Projects
Commit ddf872a5 authored by Fabrice Le Goff's avatar Fabrice Le Goff
Browse files

do not check file size if MinSizekB is not set

parent 95780cc8
No related branches found
No related tags found
No related merge requests found
Pipeline #487456 passed
...@@ -240,28 +240,28 @@ class ManagerThread(threading.Thread): ...@@ -240,28 +240,28 @@ class ManagerThread(threading.Thread):
# end if # end if
### Check for minimal file size, if needed ### Check for minimal file size, if needed
try: if self.MinSizekB:
filesize = os.path.getsize(filename) try:
except OSError as exc: filesize = os.path.getsize(filename)
if exc.errno == errno.ENOENT: except OSError as exc:
# The file has been removed by an external cause. if exc.errno == errno.ENOENT:
# This is bad but this is not a reason to crash. # The file has been removed by an external cause.
self.logger.critical('error getting file size for %s: not present (deleted by external cause)', filename) # This is bad but this is not a reason to crash.
continue self.logger.critical('error getting file size for %s: no such file', filename)
else: continue
raise exc else:
raise exc
if self.MinSizekB and \
filesize/1024.< self.MinSizekB: if filesize/1024.< self.MinSizekB:
self.logger.debug('File %s is too small. Skipping.', filename) self.logger.debug('File %s is too small. Skipping.', filename)
if self.RemoveSmallFiles: if self.RemoveSmallFiles:
self.logger.debug('File %s is too small. Deleting.', filename) self.logger.debug('File %s is too small. Deleting.', filename)
try: try:
os.remove(filename) os.remove(filename)
except OSError, ex: except OSError, ex:
self.logger.warning('Cannot delete %s. ERROR: %s', filename, ex.__repr__()) self.logger.warning('Cannot delete %s. ERROR: %s', filename, ex.__repr__())
continue continue
##### Do not take already listed files ##### ##### Do not take already listed files #####
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment