From 0471c646a878400a6d302e9ca97fb3bc1507ebc2 Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Tue, 13 Sep 2022 12:52:41 +0200 Subject: [PATCH] osbuild-mpp: fix YAMLError.problem accessors The `problem` member is only defined if a problem-mark is present. If the mark is not set, we get no details on the error whatsoever and have to just print a generic error message. Signed-off-by: David Rheinsberg --- tools/osbuild-mpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp index a88d49d1..9cf20094 100755 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -927,11 +927,11 @@ class ManifestFile: try: data = yaml_load_ordered(f) except yaml.YAMLError as err: - pos = "" + prob = "" if hasattr(err, 'problem_mark'): mark = err.problem_mark - pos = f" at line {mark.line+1} (col {mark.column+1})" - print(f"Invalid yaml in \"{path}\": {err.problem}{pos}") + prob = f": {err.problem} at line {mark.line+1} (col {mark.column+1})" + print(f"Invalid yaml in \"{path}\"{prob}") sys.exit(1) else: try: