qvm-shutdown: Allow multiple VMs to be shut down with one invocation
Prior to this commit, qvm-shutdown had a limitation where only one VM name could be passed in via the command line for shutting down. This commit removes the aforementioned limitation by adapting the code for multiple command line arguments. Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
This commit is contained in:
parent
1d9d59a335
commit
e499e6e88c
@ -47,7 +47,7 @@ def main():
|
||||
"repeated)")
|
||||
|
||||
(options, args) = parser.parse_args ()
|
||||
if not options.shutdown_all and (len (args) != 1):
|
||||
if not options.shutdown_all and not args:
|
||||
parser.error ("You must specify VM name!")
|
||||
|
||||
qvm_collection = QubesVmCollection()
|
||||
@ -66,12 +66,12 @@ def main():
|
||||
if vm.is_running():
|
||||
vms_list.append (vm)
|
||||
else:
|
||||
vmname = args[0]
|
||||
vm = qvm_collection.get_vm_by_name(vmname)
|
||||
if vm is None:
|
||||
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system!".format(vmname)
|
||||
exit(1)
|
||||
vms_list.append(vm)
|
||||
for vmname in args:
|
||||
vm = qvm_collection.get_vm_by_name(vmname)
|
||||
if vm is None:
|
||||
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system!".format(vmname)
|
||||
exit(1)
|
||||
vms_list.append(vm)
|
||||
|
||||
# Check VMs network dependencies
|
||||
if not options.force:
|
||||
|
Loading…
Reference in New Issue
Block a user