Merge branch 'bugfix/master-server-dir' into 'dev'

Fix bug where "servers" was not appended

See merge request crafty-controller/crafty-4!567
This commit is contained in:
Iain Powrie 2023-03-04 15:24:27 +00:00
commit d00262ae39
3 changed files with 13 additions and 11 deletions

View File

@ -15,6 +15,7 @@
- Optimize world size calculation ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/550))
- Only copy bedrock_server executable on update ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/562))
- Fix bug where unloaded servers could not be deleted ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/566))
- Fix bug where "servers" was not appended ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/567))
### Tweaks
- Cleanup authentication helpers ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/545))
- Optimize file upload progress WS ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/546))

View File

@ -1024,6 +1024,7 @@ class Controller:
def t_update_master_server_dir(self, new_server_path, user_id):
new_server_path = self.helper.wtol_path(new_server_path)
new_server_path = os.path.join(new_server_path, "servers")
self.helper.websocket_helper.broadcast_page(
"/panel/panel_config", "move_status", "Checking dir"
)
@ -1055,7 +1056,7 @@ class Controller:
self.helper.websocket_helper.broadcast_page(
"/panel/panel_config", "move_status", "Checking permissions"
)
if not self.helper.ensure_dir_exists(os.path.join(new_server_path, "servers")):
if not self.helper.ensure_dir_exists(new_server_path):
self.helper.websocket_helper.broadcast_user(
user_id,
"send_start_error",
@ -1074,8 +1075,8 @@ class Controller:
# move the servers
for server in servers:
server_path = server.get("path")
new_server_path = os.path.join(
new_server_path, "servers", server.get("server_uuid")
new_local_server_path = os.path.join(
new_server_path, server.get("server_uuid")
)
if os.path.isdir(server_path):
self.helper.websocket_helper.broadcast_page(
@ -1086,7 +1087,7 @@ class Controller:
try:
self.file_helper.move_dir(
server_path,
new_server_path,
new_local_server_path,
)
except FileExistsError as e:
logger.error(f"Failed to move server with error: {e}")
@ -1096,19 +1097,19 @@ class Controller:
# reset executable path
if current_master in server["executable"]:
server_obj.executable = str(server["executable"]).replace(
current_master, new_server_path
current_master, new_local_server_path
)
# reset run command path
if current_master in server["execution_command"]:
server_obj.execution_command = str(server["execution_command"]).replace(
current_master, new_server_path
current_master, new_local_server_path
)
# reset log path
if current_master in server["log_path"]:
server_obj.log_path = str(server["log_path"]).replace(
current_master, new_server_path
current_master, new_local_server_path
)
server_obj.path = new_server_path
server_obj.path = new_local_server_path
failed = False
for s in self.servers.failed_servers:
if int(s["server_id"]) == int(server.get("server_id")):

View File

@ -849,9 +849,9 @@ class PanelHandler(BaseHandler):
page_data["auth-servers"] = auth_servers
page_data["role-servers"] = auth_role_servers
page_data["user-roles"] = user_roles
page_data[
"servers_dir"
] = self.controller.management.get_master_server_dir()
page_data["servers_dir"], _tail = os.path.split(
self.controller.management.get_master_server_dir()
)
page_data["users"] = self.controller.users.user_query(exec_user["user_id"])
page_data["roles"] = self.controller.users.user_role_query(