Merge remote-tracking branch 'origin/pr/84'
* origin/pr/84: Fixed typo in documentation Documentation is important! Added shortcuts to manpages added tests for shortcuts diff doesn't set template added --standalone and --disp shortcuts
This commit is contained in:
commit
558c5d4a7c
@ -24,6 +24,14 @@ Options
|
||||
|
||||
Decrease verbosity.
|
||||
|
||||
.. option:: --standalone
|
||||
|
||||
shortcut for --class StandaloneVM, see below
|
||||
|
||||
.. option:: --disp
|
||||
|
||||
shortcut for --class DispVM --label red, see below
|
||||
|
||||
.. option:: --help-classes
|
||||
|
||||
List available qube classes and exit. See below for short description.
|
||||
|
@ -328,3 +328,25 @@ class TC_00_qvm_create(qubesadmin.tests.QubesTestCase):
|
||||
app=self.app)
|
||||
self.assertIn('red, blue', stderr.getvalue())
|
||||
self.assertAllCalled()
|
||||
|
||||
def test_014_standalone_shortcut(self):
|
||||
self.app.expected_calls[('dom0', 'admin.vm.Create.StandaloneVM',
|
||||
None, b'name=new-vm label=red')] = b'0\x00'
|
||||
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
||||
b'0\x00red\nblue\n'
|
||||
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
||||
b'0\x00new-vm class=StandaloneVM state=Halted\n'
|
||||
qubesadmin.tools.qvm_create.main(['-l', 'red', '--standalone', 'new-vm'],
|
||||
app=self.app)
|
||||
self.assertAllCalled()
|
||||
|
||||
def test_015_disp_shortcut(self):
|
||||
self.app.expected_calls[('dom0', 'admin.vm.Create.DispVM',
|
||||
None, b'name=new-vm label=red')] = b'0\x00'
|
||||
self.app.expected_calls[('dom0', 'admin.label.List', None, None)] = \
|
||||
b'0\x00red\nblue\n'
|
||||
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = \
|
||||
b'0\x00new-vm class=DispVM state=Halted\n'
|
||||
qubesadmin.tools.qvm_create.main(['--disp', 'new-vm'],
|
||||
app=self.app)
|
||||
self.assertAllCalled()
|
||||
|
@ -43,6 +43,14 @@ parser.add_argument('--class', '-C', dest='cls',
|
||||
default='AppVM',
|
||||
help='specify the class of the new domain (default: %(default)s)')
|
||||
|
||||
parser.add_argument('--standalone',
|
||||
action="store_true",
|
||||
help=' shortcut for --class StandaloneVM')
|
||||
|
||||
parser.add_argument('--disp',
|
||||
action="store_true",
|
||||
help='alias for --class DispVM --label red')
|
||||
|
||||
parser.add_argument('--property', '--prop',
|
||||
action=qubesadmin.tools.PropertyAction,
|
||||
help='set domain\'s property, like "internal", "memory" or "vcpus"')
|
||||
@ -113,6 +121,13 @@ def main(args=None, app=None):
|
||||
if args.one_pool:
|
||||
pool = args.one_pool
|
||||
|
||||
if args.disp:
|
||||
args.properties.setdefault('label', 'red')
|
||||
args.cls = 'DispVM'
|
||||
|
||||
if args.standalone:
|
||||
args.cls = 'StandaloneVM'
|
||||
|
||||
if 'label' not in args.properties:
|
||||
parser.error('--label option is mandatory')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user