mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-18 17:15:13 +01:00
Default to not delete logs
This commit is contained in:
parent
6e35d4ae97
commit
39190ed43b
@ -441,7 +441,7 @@ class Helpers:
|
||||
"reset_secrets_on_next_boot": False,
|
||||
"monitored_mounts": mounts,
|
||||
"dir_size_poll_freq_minutes": 5,
|
||||
"crafty_logs_delete_after_days": 14,
|
||||
"crafty_logs_delete_after_days": 0,
|
||||
}
|
||||
|
||||
def get_all_settings(self):
|
||||
|
@ -774,16 +774,19 @@ class TasksManager:
|
||||
"session.log",
|
||||
"commander.log",
|
||||
]
|
||||
|
||||
log_files = list(
|
||||
filter(
|
||||
lambda val: val not in latest_log_files,
|
||||
os.listdir(logs_path),
|
||||
# we won't delete if delete logs after is set to 0
|
||||
if logs_delete_after != 0:
|
||||
log_files = list(
|
||||
filter(
|
||||
lambda val: val not in latest_log_files,
|
||||
os.listdir(logs_path),
|
||||
)
|
||||
)
|
||||
)
|
||||
for log_file in log_files:
|
||||
log_file_path = os.path.join(logs_path, log_file)
|
||||
if Helpers.check_file_exists(
|
||||
log_file_path
|
||||
) and Helpers.is_file_older_than_x_days(log_file_path, logs_delete_after):
|
||||
os.remove(log_file_path)
|
||||
for log_file in log_files:
|
||||
log_file_path = os.path.join(logs_path, log_file)
|
||||
if Helpers.check_file_exists(
|
||||
log_file_path
|
||||
) and Helpers.is_file_older_than_x_days(
|
||||
log_file_path, logs_delete_after
|
||||
):
|
||||
os.remove(log_file_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user