Clean up backup configs when deleting servers

This commit is contained in:
amcmanu3 2022-10-04 16:37:53 -04:00
parent 2706ffddbe
commit c58e4e3ebf
2 changed files with 9 additions and 0 deletions

View File

@ -134,8 +134,13 @@ class ServersController(metaclass=Singleton):
role_id = role.role_id
role_data = RolesController.get_role_with_servers(role_id)
role_data["servers"] = {server_id}
# Remove server id permissions from role
PermissionsServers.delete_roles_permissions(role_id, role_data["servers"])
# Remove roles from server
PermissionsServers.remove_roles_of_server(server_id)
# Remove backup configs tied to server
self.management_helper.remove_backup_config(server_id)
# Finally remove server
self.servers_helper.remove_server(server_id)
@staticmethod

View File

@ -367,6 +367,10 @@ class HelpersManagement:
}
return conf
@staticmethod
def remove_backup_config(server_id):
Backups.delete().where(Backups.server_id == server_id).execute()
def set_backup_config(
self,
server_id: int,