Merge branch 'pretzel-branch' into 'dev'

Pretzel branch

See merge request crafty-controller/crafty-commander!138
This commit is contained in:
Andrew 2022-01-19 23:37:06 +00:00
commit 6b9f50a739
2 changed files with 8 additions and 5 deletions

View File

@ -163,7 +163,10 @@ class Controller:
for server in auth_servers: for server in auth_servers:
final_path = os.path.join(server_path, str(server['server_name'])) final_path = os.path.join(server_path, str(server['server_name']))
os.mkdir(final_path) 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 #Copy crafty logs to archive dir
full_log_name = os.path.join(crafty_path, 'logs') full_log_name = os.path.join(crafty_path, 'logs')
shutil.copytree(os.path.join(self.project_root, 'logs'), full_log_name) shutil.copytree(os.path.join(self.project_root, 'logs'), full_log_name)
@ -197,7 +200,7 @@ class Controller:
def get_server_data(self, server_id: str): def get_server_data(self, server_id: str):
for s in self.servers_list: 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'] return s['server_data_obj']
logger.warning("Unable to find server object for server id {}".format(server_id)) logger.warning("Unable to find server object for server id {}".format(server_id))
@ -447,7 +450,7 @@ class Controller:
for s in self.servers_list: for s in self.servers_list:
# if this is the droid... im mean server we are looking for... # 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_data = self.get_server_data(server_id)
server_name = server_data['server_name'] server_name = server_data['server_name']
backup_dir = self.servers.get_server_data_by_id(server_id)['backup_path'] backup_dir = self.servers.get_server_data_by_id(server_id)['backup_path']

View File

@ -427,7 +427,7 @@ class AjaxHandler(BaseHandler):
server_data = self.controller.get_server_data(server_id) server_data = self.controller.get_server_data(server_id)
server_name = server_data['server_name'] 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), "Deleted server {} named {}".format(server_id, server_name),
server_id, server_id,
self.get_remote_ip()) self.get_remote_ip())
@ -447,7 +447,7 @@ class AjaxHandler(BaseHandler):
server_data = self.controller.get_server_data(server_id) server_data = self.controller.get_server_data(server_id)
server_name = server_data['server_name'] 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), "Deleted server {} named {}".format(server_id, server_name),
server_id, server_id,
self.get_remote_ip()) self.get_remote_ip())