Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/239'
Browse files Browse the repository at this point in the history
* origin/pr/239:
  add missing docstring
  add derived_vms property
  • Loading branch information
marmarek committed Apr 27, 2023
2 parents 22cba9b + 290e524 commit b1e1861
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions qubesadmin/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,25 @@ def appvms(self):
except AttributeError:
pass

@property
def derived_vms(self):
"""
Return list of all domains based on the current TemplateVM
at any level of inheritance.
"""
return list(QubesVM._get_derived_vms(self))

@staticmethod
def _get_derived_vms(vm):
"""
Return `set` of all domains based on the current TemplateVM
at any level of inheritance.
"""
result = set(vm.appvms)
for appvm in vm.appvms:
result.update(QubesVM._get_derived_vms(appvm))
return result

@property
def connected_vms(self):
''' Return a generator containing all domains connected to the current
Expand Down

0 comments on commit b1e1861

Please sign in to comment.