Merge branch 'bug/pretzel-support-log-temp-cleanup' into 'dev'

Cleanup temp dirs on support log creation

See merge request crafty-controller/crafty-4!286
This commit is contained in:
Andrew 2022-06-01 22:33:52 +00:00
commit ec730a1694
2 changed files with 9 additions and 0 deletions

View File

@ -148,6 +148,14 @@ class Controller:
self.users.stop_prepare(exec_user["user_id"]) self.users.stop_prepare(exec_user["user_id"])
self.support_scheduler.remove_job("logs_" + str(exec_user["user_id"])) self.support_scheduler.remove_job("logs_" + str(exec_user["user_id"]))
FileHelpers.del_dirs(temp_dir)
def del_support_file(self, temp_zip_storage):
try:
FileHelpers.del_file(temp_zip_storage)
except FileNotFoundError:
logger.info("No temp file found. Assuming it's already been cleaned up")
def add_system_user(self): def add_system_user(self):
self.users_helper.add_user( self.users_helper.add_user(
"system", "system",

View File

@ -1220,6 +1220,7 @@ class PanelHandler(BaseHandler):
# same time, the chunks in memory will keep # same time, the chunks in memory will keep
# increasing and will eat up the RAM # increasing and will eat up the RAM
del chunk del chunk
self.controller.del_support_file(temp_zip_storage)
self.redirect("/panel/dashboard") self.redirect("/panel/dashboard")
else: else:
self.redirect("/panel/error?error=No path found for support logs") self.redirect("/panel/error?error=No path found for support logs")