Skip to content

Commit

Permalink
Fix error message for non-existing VM passed to a VMProperty
Browse files Browse the repository at this point in the history
Trying to set a VMProperty (netvm, template, ...) to a non-existing VM
previously raised a QubesVMNotFoundError. While this is not wrong
qvm-prefs can't distinguish this from other cases (for example see [1])
so instead raise QubesPropertyValueError with a matching error message.

Fixes QubesOS/qubes-issues#6966

[1]: https://github.com/QubesOS/qubes-core-admin-client/blob/e7892560a3a64b924c20dd81bb7f718b5b1c49de/qubesadmin/base.py#L382
  • Loading branch information
HW42 committed Dec 11, 2023
1 parent 2c18f2c commit 83b1959
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qubes/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,10 @@ def __set__(self, instance, value):
try:
vm = app.domains[value]
except KeyError:
raise qubes.exc.QubesVMNotFoundError(value)
raise qubes.exc.QubesPropertyValueError(instance, self, value,
"Can't set {!s} to non-existing qube {!s}".format(
self,
value))

if not isinstance(vm, self.vmclass):
raise qubes.exc.QubesPropertyValueError(instance, self, value,
Expand Down

0 comments on commit 83b1959

Please sign in to comment.