From 15c3c0a27ee23e1ca95fb4ca5e366165d340db5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 1 Nov 2023 13:02:35 +0100 Subject: [PATCH] stage/copy: fix exception msg when parsing mounts and inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Functions for parsing mounts and inputs raise an exception if the referenced entity can't be found in the stage options. However, the exception message always included the value of the `root` variable, which is `None` when an exception is risen. Instead of the `root` value, the `name` variable with the entity name should be used. Signed-off-by: Tomáš Hozza --- stages/org.osbuild.copy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stages/org.osbuild.copy b/stages/org.osbuild.copy index 7f04dbca..3c137af5 100755 --- a/stages/org.osbuild.copy +++ b/stages/org.osbuild.copy @@ -92,7 +92,7 @@ def parse_mount(url: ParseResult, args: Dict): if name: root = args["mounts"].get(name, {}).get("path") if not root: - raise ValueError(f"Unknown mount '{root}'") + raise ValueError(f"Unknown mount '{name}'") else: root = args["paths"]["mounts"] @@ -103,7 +103,7 @@ def parse_input(url: ParseResult, args: Dict): name = url.netloc root = args["inputs"].get(name, {}).get("path") if root is None: - raise ValueError(f"Unknown input '{root}'") + raise ValueError(f"Unknown input '{name}'") return root