mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fixing Server Deletion Error
This commit is contained in:
parent
eee9796428
commit
eb3b86641d
@ -36,7 +36,8 @@ class Servers_Controller:
|
||||
|
||||
@staticmethod
|
||||
def remove_server(server_id):
|
||||
return servers_helper.remove_server(server_id)
|
||||
server_permissions.remove_roles_of_server(server_id)
|
||||
servers_helper.remove_server(server_id)
|
||||
|
||||
@staticmethod
|
||||
def get_server_data_by_id(server_id):
|
||||
@ -119,6 +120,7 @@ class Servers_Controller:
|
||||
def can_stop_no_players(server_id, time_limit):
|
||||
return servers_helper.can_stop_no_players(server_id, time_limit)
|
||||
|
||||
@staticmethod
|
||||
def set_waiting_start(server_id, value):
|
||||
servers_helper.set_waiting_start(server_id, value)
|
||||
|
||||
@ -144,7 +146,7 @@ class Servers_Controller:
|
||||
return None
|
||||
|
||||
return json.loads(content)
|
||||
|
||||
|
||||
def check_for_old_logs(self):
|
||||
servers = servers_helper.get_all_defined_servers()
|
||||
for server in servers:
|
||||
|
@ -278,8 +278,11 @@ class Stats:
|
||||
p_stats = self._get_process_stats(server_obj.PID)
|
||||
|
||||
# TODO: search server properties file for possible override of 127.0.0.1
|
||||
internal_ip = server['server_ip']
|
||||
server_port = server['server_port']
|
||||
#internal_ip = server['server_ip']
|
||||
#server_port = server['server_port']
|
||||
internal_ip = server_data.get('server_ip', "127.0.0.1")
|
||||
server_port = server_settings.get('server-port', "25565")
|
||||
|
||||
|
||||
logger.debug("Pinging server '{}' on {}:{}".format(server.name, internal_ip, server_port))
|
||||
int_mc_ping = ping(internal_ip, int(server_port))
|
||||
|
@ -136,6 +136,11 @@ class Permissions_Servers:
|
||||
def delete_roles_permissions(role_id, removed_servers={}):
|
||||
return Role_Servers.delete().where(Role_Servers.role_id == role_id).where(Role_Servers.server_id.in_(removed_servers)).execute()
|
||||
|
||||
@staticmethod
|
||||
def remove_roles_of_server(server_id):
|
||||
with database.atomic():
|
||||
return Role_Servers.delete().where(Role_Servers.server_id == server_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def get_user_permissions_list(user_id, server_id):
|
||||
permissions_mask = ''
|
||||
|
@ -112,7 +112,6 @@ class helper_servers:
|
||||
@staticmethod
|
||||
def remove_server(server_id):
|
||||
with database.atomic():
|
||||
Role_Servers.delete().where(Role_Servers.server_id == server_id).execute()
|
||||
Servers.delete().where(Servers.server_id == server_id).execute()
|
||||
|
||||
@staticmethod
|
||||
@ -183,7 +182,7 @@ class helper_servers:
|
||||
@staticmethod
|
||||
def can_stop_no_players(server_id, time_limit):
|
||||
can = False
|
||||
ttl_no_players = get_TTL_without_player(server_id)
|
||||
ttl_no_players = servers_helper.get_TTL_without_player(server_id)
|
||||
if (time_limit == -1) or (ttl_no_players > time_limit):
|
||||
can = True
|
||||
return can
|
||||
|
Loading…
Reference in New Issue
Block a user