From 8981e71b889b6b6cdec75e06d869a63b6e366c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 19 Oct 2017 14:55:33 +0200 Subject: [PATCH] tools: fix handling qvm-run --no-autostart Fixes QubesOS/qubes-issues#3083 --- qubesadmin/tests/tools/qvm_run.py | 16 ++++++++++++++++ qubesadmin/tools/qvm_run.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/qubesadmin/tests/tools/qvm_run.py b/qubesadmin/tests/tools/qvm_run.py index a770187..9f510ea 100644 --- a/qubesadmin/tests/tools/qvm_run.py +++ b/qubesadmin/tests/tools/qvm_run.py @@ -404,3 +404,19 @@ class TC_00_qvm_run(qubesadmin.tests.QubesTestCase): ('test-vm', 'qubes.VMShell', b'command; exit\n'), ]) self.assertAllCalled() + + def test_013_no_autostart(self): + self.app.expected_calls[ + ('dom0', 'admin.vm.List', None, None)] = \ + b'0\x00test-vm class=AppVM state=Running\n' \ + b'test-vm2 class=AppVM state=Running\n' \ + b'test-vm3 class=AppVM state=Halted\n' + self.app.expected_calls[ + ('test-vm3', 'admin.vm.List', None, None)] = \ + b'0\x00test-vm3 class=AppVM state=Halted\n' + ret = qubesadmin.tools.qvm_run.main( + ['--no-gui', '--no-autostart', 'test-vm3', 'command'], + app=self.app) + self.assertEqual(ret, 0) + self.assertEqual(self.app.service_calls, []) + self.assertAllCalled() diff --git a/qubesadmin/tools/qvm_run.py b/qubesadmin/tools/qvm_run.py index 2bf8663..8de455c 100644 --- a/qubesadmin/tools/qvm_run.py +++ b/qubesadmin/tools/qvm_run.py @@ -41,7 +41,7 @@ parser.add_argument('--autostart', '--auto', '-a', help='option ignored, this is default') parser.add_argument('--no-autostart', '--no-auto', '-n', - action='store_false', + action='store_false', dest='autostart', help='do not autostart qube') parser.add_argument('--pass-io', '-p',