From c6f653822eedd1c8a8f2203c06408c312578a9c3 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 4 Aug 2019 18:45:42 +0200 Subject: [PATCH] Gotta feed the file path, not the file itself --- src/yunohost/log.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/yunohost/log.py b/src/yunohost/log.py index aa41cd85f..6c748f145 100644 --- a/src/yunohost/log.py +++ b/src/yunohost/log.py @@ -180,21 +180,20 @@ def log_display(path, number=50, share=False): # Display metadata if exist if os.path.exists(md_path): - with open(md_path, "r") as md_file: - try: - metadata = read_yaml(md_file) - except MoulinetteError as e: - error = m18n.n('log_corrupted_md_file', md_file=md_path, error=e) - if os.path.exists(log_path): - logger.warning(error) - else: - raise YunohostError(error) + try: + metadata = read_yaml(md_path) + except MoulinetteError as e: + error = m18n.n('log_corrupted_md_file', md_file=md_path, error=e) + if os.path.exists(log_path): + logger.warning(error) else: - infos['metadata_path'] = md_path - infos['metadata'] = metadata + raise YunohostError(error) + else: + infos['metadata_path'] = md_path + infos['metadata'] = metadata - if 'log_path' in metadata: - log_path = metadata['log_path'] + if 'log_path' in metadata: + log_path = metadata['log_path'] # Display logs if exist if os.path.exists(log_path):