From 00c99805b871c7669bda5f857cebb327ff50a78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 24 Feb 2025 02:08:31 +0100 Subject: [PATCH] Fix exception on unknown label when creating a VM get_label() already raises QubesLabelNotFoundError, do not convert it to a generic one. --- qubes/api/admin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qubes/api/admin.py b/qubes/api/admin.py index 7eb0448dd..4dcfc776b 100644 --- a/qubes/api/admin.py +++ b/qubes/api/admin.py @@ -1216,10 +1216,8 @@ async def _vm_create( self.enforce(not untrusted_value.isdigit()) allowed_chars = string.ascii_letters + string.digits + "-_." self.enforce(all(c in allowed_chars for c in untrusted_value)) - try: - kwargs["label"] = self.app.get_label(untrusted_value) - except KeyError: - raise qubes.exc.QubesValueError + # this may raise QubesLabelNotFoundError + kwargs["label"] = self.app.get_label(untrusted_value) elif untrusted_key == "pool" and allow_pool: if pool is not None: