From 2d42f59377d955f2d7d589b831dea419903a9862 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 27 Jan 2024 15:31:10 +0100 Subject: [PATCH] logs: remove the intermediate useless 'categories' directory, this is triggering me so much --- hooks/conf_regen/01-yunohost | 7 +++++++ src/log.py | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hooks/conf_regen/01-yunohost b/hooks/conf_regen/01-yunohost index e4bf2f0f2..5799447c8 100755 --- a/hooks/conf_regen/01-yunohost +++ b/hooks/conf_regen/01-yunohost @@ -218,6 +218,13 @@ do_post_regen() { chown ynh-portal:root /var/log/yunohost-portalapi.log chmod 600 /var/log/yunohost-portalapi.log + # Legacy log tree structure + if [ ! -e /var/log/yunohost/operations ] && [ -d /var/log/yunohost/categories/operation ] && [ ! -L /var/log/yunohost/categories/operation ] + then + mv /var/log/yunohost/categories/operation /var/log/yunohost/operations + ln -s /var/log/yunohost/operations /var/log/yunohost/categories/operation + fi + ###################### # Enfore permissions # ###################### diff --git a/src/log.py b/src/log.py index 73d8090d5..121aa6821 100644 --- a/src/log.py +++ b/src/log.py @@ -1,4 +1,3 @@ -# # Copyright (c) 2024 YunoHost Contributors # # This file is part of YunoHost (see https://yunohost.org) @@ -36,8 +35,7 @@ from moulinette.utils.filesystem import read_file, read_yaml logger = getLogger("yunohost.log") -CATEGORIES_PATH = "/var/log/yunohost/categories/" -OPERATIONS_PATH = "/var/log/yunohost/categories/operation/" +OPERATIONS_PATH = "/var/log/yunohost/operations/" METADATA_FILE_EXT = ".yml" LOG_FILE_EXT = ".log" @@ -214,7 +212,7 @@ def log_show( infos = {} # If it's a unit operation, display the name and the description - if base_path.startswith(CATEGORIES_PATH): + if base_path.startswith(OPERATIONS_PATH): infos["description"] = _get_description_from_name(base_filename) infos["name"] = base_filename