mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Merge branch 'bug/tempdir-cleanup' into 'dev'
Remove temporary directory on backup completion See merge request crafty-controller/crafty-4!284
This commit is contained in:
commit
b88752f62f
@ -690,6 +690,8 @@ class Helpers:
|
|||||||
# directory already exists - non-blocking error
|
# directory already exists - non-blocking error
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
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):
|
def create_self_signed_cert(self, cert_dir=None):
|
||||||
|
|
||||||
|
@ -877,7 +877,6 @@ class Server:
|
|||||||
os.remove(Helpers.get_os_understandable_path(oldfile_path))
|
os.remove(Helpers.get_os_understandable_path(oldfile_path))
|
||||||
|
|
||||||
self.is_backingup = False
|
self.is_backingup = False
|
||||||
FileHelpers.del_dirs(temp_dir)
|
|
||||||
logger.info(f"Backup of server: {self.name} completed")
|
logger.info(f"Backup of server: {self.name} completed")
|
||||||
self.server_scheduler.remove_job("backup_" + str(self.server_id))
|
self.server_scheduler.remove_job("backup_" + str(self.server_id))
|
||||||
results = {"percent": 100, "total_files": 0, "current_file": 0}
|
results = {"percent": 100, "total_files": 0, "current_file": 0}
|
||||||
@ -900,7 +899,6 @@ class Server:
|
|||||||
).format(self.name),
|
).format(self.name),
|
||||||
)
|
)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
return
|
|
||||||
except:
|
except:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
f"Failed to create backup of server {self.name} (ID {self.server_id})"
|
f"Failed to create backup of server {self.name} (ID {self.server_id})"
|
||||||
@ -915,7 +913,8 @@ class Server:
|
|||||||
results,
|
results,
|
||||||
)
|
)
|
||||||
self.is_backingup = False
|
self.is_backingup = False
|
||||||
return
|
finally:
|
||||||
|
FileHelpers.del_dirs(temp_dir)
|
||||||
|
|
||||||
def backup_status(self, source_path, dest_path):
|
def backup_status(self, source_path, dest_path):
|
||||||
results = Helpers.calc_percent(source_path, dest_path)
|
results = Helpers.calc_percent(source_path, dest_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user