logs: remove the intermediate useless 'categories' directory, this is triggering me so much

This commit is contained in:
Alexandre Aubin 2024-01-27 15:31:10 +01:00
parent 902e65f9bc
commit 2d42f59377
2 changed files with 9 additions and 4 deletions

View file

@ -218,6 +218,13 @@ do_post_regen() {
chown ynh-portal:root /var/log/yunohost-portalapi.log chown ynh-portal:root /var/log/yunohost-portalapi.log
chmod 600 /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 # # Enfore permissions #
###################### ######################

View file

@ -1,4 +1,3 @@
#
# Copyright (c) 2024 YunoHost Contributors # Copyright (c) 2024 YunoHost Contributors
# #
# This file is part of YunoHost (see https://yunohost.org) # 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") logger = getLogger("yunohost.log")
CATEGORIES_PATH = "/var/log/yunohost/categories/" OPERATIONS_PATH = "/var/log/yunohost/operations/"
OPERATIONS_PATH = "/var/log/yunohost/categories/operation/"
METADATA_FILE_EXT = ".yml" METADATA_FILE_EXT = ".yml"
LOG_FILE_EXT = ".log" LOG_FILE_EXT = ".log"
@ -214,7 +212,7 @@ def log_show(
infos = {} infos = {}
# If it's a unit operation, display the name and the description # 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["description"] = _get_description_from_name(base_filename)
infos["name"] = base_filename infos["name"] = base_filename