Merge remote-tracking branch 'origin/pr/123'
* origin/pr/123: Add test for qvm-ls --all qvm-ls: don't exclude dom0 when using --all
This commit is contained in:
commit
de1969150d
@ -120,7 +120,16 @@ class TC_50_List(qubesadmin.tests.QubesTestCase):
|
|||||||
'dom0\n'
|
'dom0\n'
|
||||||
'test-vm\n')
|
'test-vm\n')
|
||||||
|
|
||||||
def test_103_network_tree(self):
|
def test_103_list_all(self):
|
||||||
|
app = TestApp()
|
||||||
|
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
|
||||||
|
qubesadmin.tools.qvm_ls.main(['--all'], app=app)
|
||||||
|
self.assertEqual(stdout.getvalue(),
|
||||||
|
'NAME STATE CLASS LABEL TEMPLATE NETVM\n'
|
||||||
|
'dom0 Running TestVM - - -\n'
|
||||||
|
'test-vm Running TestVM - - -\n')
|
||||||
|
|
||||||
|
def test_110_network_tree(self):
|
||||||
app = TestApp()
|
app = TestApp()
|
||||||
app.domains = TestVMCollection(
|
app.domains = TestVMCollection(
|
||||||
[
|
[
|
||||||
|
@ -690,6 +690,14 @@ def main(args=None, app=None):
|
|||||||
else:
|
else:
|
||||||
domains = args.app.domains
|
domains = args.app.domains
|
||||||
|
|
||||||
|
if args.all_domains:
|
||||||
|
# Normally, --all means "all domains except for AdminVM".
|
||||||
|
# However, in the case of qvm-ls it does not make sense to exclude
|
||||||
|
# AdminVMs, so we override the list from parser.
|
||||||
|
domains = [
|
||||||
|
vm for vm in args.app.domains if vm.name not in args.exclude
|
||||||
|
]
|
||||||
|
|
||||||
if args.tags:
|
if args.tags:
|
||||||
# filter only VMs having at least one of the specified tags
|
# filter only VMs having at least one of the specified tags
|
||||||
domains = [dom for dom in domains
|
domains = [dom for dom in domains
|
||||||
|
Loading…
Reference in New Issue
Block a user