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 logging
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
import pathlib
|
||||||
import typing as t
|
import typing as t
|
||||||
|
|
||||||
from app.classes.controllers.roles_controller import RolesController
|
from app.classes.controllers.roles_controller import RolesController
|
||||||
@ -538,7 +539,14 @@ class ServersController(metaclass=Singleton):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
log_files = list(
|
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:
|
for log_file in log_files:
|
||||||
log_file_path = os.path.join(logs_path, log_file)
|
log_file_path = os.path.join(logs_path, log_file)
|
||||||
|
@ -159,7 +159,10 @@ class Controller:
|
|||||||
final_path += "_" + server["server_uuid"]
|
final_path += "_" + server["server_uuid"]
|
||||||
os.mkdir(final_path)
|
os.mkdir(final_path)
|
||||||
try:
|
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:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to copy file with error: {e}")
|
logger.warning(f"Failed to copy file with error: {e}")
|
||||||
# Copy crafty logs to archive dir
|
# Copy crafty logs to archive dir
|
||||||
|
Loading…
Reference in New Issue
Block a user