mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix log file path issue for support log/log delete
This commit is contained in:
parent
b69cdd757e
commit
f265b070c0
@ -2,6 +2,7 @@ import os
|
||||
import logging
|
||||
import time
|
||||
import json
|
||||
import pathlib
|
||||
import typing as t
|
||||
|
||||
from app.classes.controllers.roles_controller import RolesController
|
||||
@ -538,7 +539,14 @@ class ServersController(metaclass=Singleton):
|
||||
continue
|
||||
|
||||
log_files = list(
|
||||
filter(lambda val: val != latest_log_file, os.listdir(logs_path))
|
||||
filter(
|
||||
lambda val: val != latest_log_file,
|
||||
os.listdir(
|
||||
pathlib.Path(
|
||||
server["path"], os.path.split(server["log_path"])[0]
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
for log_file in log_files:
|
||||
log_file_path = os.path.join(logs_path, log_file)
|
||||
|
@ -159,7 +159,10 @@ class Controller:
|
||||
final_path += "_" + server["server_uuid"]
|
||||
os.mkdir(final_path)
|
||||
try:
|
||||
FileHelpers.copy_file(server["log_path"], final_path)
|
||||
FileHelpers.copy_file(
|
||||
pathlib.Path(server["path"], server["log_path"]),
|
||||
final_path,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to copy file with error: {e}")
|
||||
# Copy crafty logs to archive dir
|
||||
|
Loading…
Reference in New Issue
Block a user