qvm-device: improve error message on invalid device type
Fixes QubesOS/qubes-issues#6057
This commit is contained in:
parent
e6186239ef
commit
07dfe826f7
@ -81,17 +81,22 @@ def list_devices(args):
|
|||||||
app = args.app
|
app = args.app
|
||||||
|
|
||||||
devices = set()
|
devices = set()
|
||||||
if hasattr(args, 'domains') and args.domains:
|
try:
|
||||||
for domain in args.domains:
|
if hasattr(args, 'domains') and args.domains:
|
||||||
for dev in domain.devices[args.devclass].attached():
|
for domain in args.domains:
|
||||||
devices.add(dev)
|
for dev in domain.devices[args.devclass].attached():
|
||||||
for dev in domain.devices[args.devclass].available():
|
devices.add(dev)
|
||||||
devices.add(dev)
|
for dev in domain.devices[args.devclass].available():
|
||||||
|
devices.add(dev)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for domain in app.domains:
|
for domain in app.domains:
|
||||||
for dev in domain.devices[args.devclass].available():
|
for dev in domain.devices[args.devclass].available():
|
||||||
devices.add(dev)
|
devices.add(dev)
|
||||||
|
except qubesadmin.exc.QubesDaemonAccessError:
|
||||||
|
raise qubesadmin.exc.QubesException(
|
||||||
|
"Failed to list '%s' devices, this device type either "
|
||||||
|
"does not exist or you do not have access to it.", args.devclass)
|
||||||
|
|
||||||
result = {dev: Line(dev) for dev in devices}
|
result = {dev: Line(dev) for dev in devices}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user