diff --git a/locales/en.json b/locales/en.json index 930722a9e..1b97fd90f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -205,6 +205,7 @@ "invalid_url_format": "Invalid URL format", "ip6tables_unavailable": "You cannot play with ip6tables here. You are either in a container or your kernel does not support it", "iptables_unavailable": "You cannot play with iptables here. You are either in a container or your kernel does not support it", + "log_corrupted_md_file": "The yaml metadata file associated with logs is corrupted : '{md_file}'", "log_does_exists": "There is not operation log with the name '{log}', use 'yunohost log list to see all available operation logs'", "log_operation_unit_unclosed_properly": "Operation unit has not been closed properly", "log_app_removelist": "Remove an application list", diff --git a/src/yunohost/log.py b/src/yunohost/log.py index 94671321b..7ad52720f 100644 --- a/src/yunohost/log.py +++ b/src/yunohost/log.py @@ -123,8 +123,12 @@ def log_display(file_name, number=50): infos['metadata'] = metadata if 'log_path' in metadata: log_path = metadata['log_path'] - except yaml.YAMLError as exc: - print(exc) + except yaml.YAMLError: + error = m18n.n('log_corrupted_md_file', file=md_path) + if os.path.exists(log_path): + logger.warning(error) + else: + raise MoulinetteError(errno.EINVAL, error) if os.path.exists(log_path): from yunohost.service import _tail