Allow app.domains[vm] where vm is a QubesVM object
Similar as in the core-admin API.
This commit is contained in:
parent
7bca004532
commit
b8ddb39752
@ -83,6 +83,8 @@ class VMCollection(object):
|
|||||||
del self._vm_objects[name]
|
del self._vm_objects[name]
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
|
if isinstance(item, qubesadmin.vm.QubesVM):
|
||||||
|
item = item.name
|
||||||
if not self.app.blind_mode and item not in self:
|
if not self.app.blind_mode and item not in self:
|
||||||
raise KeyError(item)
|
raise KeyError(item)
|
||||||
return self.get_blind(item)
|
return self.get_blind(item)
|
||||||
@ -104,6 +106,8 @@ class VMCollection(object):
|
|||||||
return self._vm_objects[item]
|
return self._vm_objects[item]
|
||||||
|
|
||||||
def __contains__(self, item):
|
def __contains__(self, item):
|
||||||
|
if isinstance(item, qubesadmin.vm.QubesVM):
|
||||||
|
item = item.name
|
||||||
self.refresh_cache()
|
self.refresh_cache()
|
||||||
return item in self._vm_list
|
return item in self._vm_list
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user