mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'refactor/backups' into refactor/upload-api
This commit is contained in:
commit
d6e00edf4a
@ -397,6 +397,9 @@ class HelpersManagement:
|
||||
Backups.delete().where(Backups.backup_id == backup_id).execute()
|
||||
|
||||
def add_backup_config(self, conf) -> str:
|
||||
if "excluded_dirs" in conf:
|
||||
dirs_to_exclude = ",".join(conf["excluded_dirs"])
|
||||
conf["excluded_dirs"] = dirs_to_exclude
|
||||
backup = Backups.create(**conf)
|
||||
logger.debug("Creating new backup record.")
|
||||
return backup.backup_id
|
||||
|
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import logging
|
||||
import json
|
||||
from jsonschema import validate
|
||||
@ -97,6 +98,10 @@ class ApiServersServerBackupsIndexHandler(BaseApiHandler):
|
||||
if EnumPermissionsServer.BACKUP not in server_permissions:
|
||||
# if the user doesn't have Schedule permission, return an error
|
||||
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||
# Set the backup location automatically for non-super users. We should probably
|
||||
# make the default location configurable for SU eventually
|
||||
if not auth_data[4]["superuser"]:
|
||||
data["backup_location"] = os.path.join(self.helper.backup_path, server_id)
|
||||
data["server_id"] = server_id
|
||||
if not data.get("excluded_dirs", None):
|
||||
data["excluded_dirs"] = []
|
||||
|
Loading…
Reference in New Issue
Block a user