mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-31 12:56:11 +01:00
appease the linter
This commit is contained in:
parent
fd22519ae1
commit
3621672e81
@ -569,16 +569,16 @@ class Server:
|
|||||||
backup_filename = f"{self.settings['backup_path']}/{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}"
|
backup_filename = f"{self.settings['backup_path']}/{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}"
|
||||||
logger.info(f"Creating backup of server '{self.settings['server_name']}'" +
|
logger.info(f"Creating backup of server '{self.settings['server_name']}'" +
|
||||||
f" (ID#{self.server_id}, path={self.server_path}) at '{backup_filename}'")
|
f" (ID#{self.server_id}, path={self.server_path}) at '{backup_filename}'")
|
||||||
|
|
||||||
tempDir = tempfile.mkdtemp()
|
tempDir = tempfile.mkdtemp()
|
||||||
shutil.copytree(self.server_path, tempDir, dirs_exist_ok=True)
|
shutil.copytree(self.server_path, tempDir, dirs_exist_ok=True)
|
||||||
excluded_dirs = management_helper.get_excluded_backup_dirs(self.server_id)
|
excluded_dirs = management_helper.get_excluded_backup_dirs(self.server_id)
|
||||||
server_dir = helper.get_os_understandable_path(self.settings['path'])
|
server_dir = helper.get_os_understandable_path(self.settings['path'])
|
||||||
|
|
||||||
for dir in excluded_dirs:
|
for my_dir in excluded_dirs:
|
||||||
# Take the full path of the excluded dir and replace the server path with the temp path
|
# Take the full path of the excluded dir and replace the server path with the temp path
|
||||||
# This is so that we're only deleting excluded dirs from the temp path and not the server path
|
# This is so that we're only deleting excluded dirs from the temp path and not the server path
|
||||||
excluded_dir = helper.get_os_understandable_path(dir).replace(server_dir, helper.get_os_understandable_path(tempDir))
|
excluded_dir = helper.get_os_understandable_path(my_dir).replace(server_dir, helper.get_os_understandable_path(tempDir))
|
||||||
# Next, check to see if it is a directory
|
# Next, check to see if it is a directory
|
||||||
if os.path.isdir(excluded_dir):
|
if os.path.isdir(excluded_dir):
|
||||||
# If it is a directory, recursively delete the entire directory from the backup
|
# If it is a directory, recursively delete the entire directory from the backup
|
||||||
@ -586,7 +586,7 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
# If not, just remove the file
|
# If not, just remove the file
|
||||||
os.remove(excluded_dir)
|
os.remove(excluded_dir)
|
||||||
|
|
||||||
shutil.make_archive(helper.get_os_understandable_path(backup_filename), 'zip', tempDir)
|
shutil.make_archive(helper.get_os_understandable_path(backup_filename), 'zip', tempDir)
|
||||||
|
|
||||||
while len(self.list_backups()) > conf["max_backups"] and conf["max_backups"] > 0:
|
while len(self.list_backups()) > conf["max_backups"] and conf["max_backups"] > 0:
|
||||||
|
@ -17,7 +17,6 @@ from tornado.ioloop import IOLoop
|
|||||||
#TZLocal is set as a hidden import on win pipeline
|
#TZLocal is set as a hidden import on win pipeline
|
||||||
from tzlocal import get_localzone
|
from tzlocal import get_localzone
|
||||||
from cron_validator import CronValidator
|
from cron_validator import CronValidator
|
||||||
from app.classes.controllers.management_controller import Management_Controller
|
|
||||||
|
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user