From 285a4ff9b40bbb907d3bedc8ceec92431dca9927 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 19 Jan 2022 17:23:04 -0500 Subject: [PATCH 1/2] fix error with logging so we can try to find out what's going on with windows servers not starting --- app/classes/shared/main_controller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 2f68a9c3..48390545 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -163,7 +163,10 @@ class Controller: for server in auth_servers: final_path = os.path.join(server_path, str(server['server_name'])) os.mkdir(final_path) - shutil.copy(server['log_path'], final_path) + try: + shutil.copy(server['log_path'], final_path) + except Exception as e: + logger.warning("Failed to copy file with error: {}".format(e)) #Copy crafty logs to archive dir full_log_name = os.path.join(crafty_path, 'logs') shutil.copytree(os.path.join(self.project_root, 'logs'), full_log_name) From 2f3110b107d96a3ac64824bc70e6a23c564e5d8d Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 19 Jan 2022 18:28:08 -0500 Subject: [PATCH 2/2] fix server deleting function due to type error after JWT merge. --- app/classes/shared/main_controller.py | 4 ++-- app/classes/web/ajax_handler.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 48390545..7dc4c892 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -200,7 +200,7 @@ class Controller: def get_server_data(self, server_id: str): for s in self.servers_list: - if s['server_id'] == server_id: + if str(s['server_id']) == str(server_id): return s['server_data_obj'] logger.warning("Unable to find server object for server id {}".format(server_id)) @@ -450,7 +450,7 @@ class Controller: for s in self.servers_list: # if this is the droid... im mean server we are looking for... - if s['server_id'] == server_id: + if str(s['server_id']) == str(server_id): server_data = self.get_server_data(server_id) server_name = server_data['server_name'] backup_dir = self.servers.get_server_data_by_id(server_id)['backup_path'] diff --git a/app/classes/web/ajax_handler.py b/app/classes/web/ajax_handler.py index a9009c30..38db24a5 100644 --- a/app/classes/web/ajax_handler.py +++ b/app/classes/web/ajax_handler.py @@ -427,7 +427,7 @@ class AjaxHandler(BaseHandler): server_data = self.controller.get_server_data(server_id) server_name = server_data['server_name'] - self.controller.management.add_to_audit_log(exec_user_id, + self.controller.management.add_to_audit_log(exec_user['user_id'], "Deleted server {} named {}".format(server_id, server_name), server_id, self.get_remote_ip()) @@ -447,7 +447,7 @@ class AjaxHandler(BaseHandler): server_data = self.controller.get_server_data(server_id) server_name = server_data['server_name'] - self.controller.management.add_to_audit_log(exec_user_id, + self.controller.management.add_to_audit_log(exec_user['user_id'], "Deleted server {} named {}".format(server_id, server_name), server_id, self.get_remote_ip())