diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 778bfbfb..857c4978 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -690,6 +690,8 @@ class Helpers: # directory already exists - non-blocking error except FileExistsError: pass + except PermissionError as e: + logger.critical(f"Check generated exception due to permssion error: {e}") def create_self_signed_cert(self, cert_dir=None): diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 96ce4935..6044f81f 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -877,7 +877,6 @@ class Server: os.remove(Helpers.get_os_understandable_path(oldfile_path)) self.is_backingup = False - FileHelpers.del_dirs(temp_dir) logger.info(f"Backup of server: {self.name} completed") self.server_scheduler.remove_job("backup_" + str(self.server_id)) results = {"percent": 100, "total_files": 0, "current_file": 0} @@ -900,7 +899,6 @@ class Server: ).format(self.name), ) time.sleep(3) - return except: logger.exception( f"Failed to create backup of server {self.name} (ID {self.server_id})" @@ -915,7 +913,8 @@ class Server: results, ) self.is_backingup = False - return + finally: + FileHelpers.del_dirs(temp_dir) def backup_status(self, source_path, dest_path): results = Helpers.calc_percent(source_path, dest_path)