mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Use read_yaml instead of custom yaml load
This commit is contained in:
parent
705d50fa6e
commit
008c2886aa
1 changed files with 3 additions and 8 deletions
|
@ -35,7 +35,7 @@ from logging import FileHandler, getLogger, Formatter
|
||||||
from moulinette import m18n, msettings
|
from moulinette import m18n, msettings
|
||||||
from yunohost.utils.error import YunohostError
|
from yunohost.utils.error import YunohostError
|
||||||
from moulinette.utils.log import getActionLogger
|
from moulinette.utils.log import getActionLogger
|
||||||
from moulinette.utils.filesystem import read_file
|
from moulinette.utils.filesystem import read_file, read_yaml
|
||||||
|
|
||||||
CATEGORIES_PATH = '/var/log/yunohost/categories/'
|
CATEGORIES_PATH = '/var/log/yunohost/categories/'
|
||||||
OPERATIONS_PATH = '/var/log/yunohost/categories/operation/'
|
OPERATIONS_PATH = '/var/log/yunohost/categories/operation/'
|
||||||
|
@ -102,13 +102,8 @@ def log_list(category=[], limit=None, with_details=False):
|
||||||
entry["started_at"] = log_datetime
|
entry["started_at"] = log_datetime
|
||||||
|
|
||||||
if with_details:
|
if with_details:
|
||||||
with open(md_path, "r") as md_file:
|
metadata = read_yaml(md_path)
|
||||||
try:
|
entry["success"] = metadata.get("success", "?") if metadata else "?"
|
||||||
metadata = yaml.safe_load(md_file)
|
|
||||||
except yaml.YAMLError:
|
|
||||||
logger.warning(m18n.n('log_corrupted_md_file', md_file=md_path))
|
|
||||||
|
|
||||||
entry["success"] = metadata.get("success", "?") if metadata else "?"
|
|
||||||
|
|
||||||
result[category].append(entry)
|
result[category].append(entry)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue