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)")
|
"repeated)")
|
||||||
|
|
||||||
(options, args) = parser.parse_args ()
|
(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!")
|
parser.error ("You must specify VM name!")
|
||||||
|
|
||||||
qvm_collection = QubesVmCollection()
|
qvm_collection = QubesVmCollection()
|
||||||
@ -66,12 +66,12 @@ def main():
|
|||||||
if vm.is_running():
|
if vm.is_running():
|
||||||
vms_list.append (vm)
|
vms_list.append (vm)
|
||||||
else:
|
else:
|
||||||
vmname = args[0]
|
for vmname in args:
|
||||||
vm = qvm_collection.get_vm_by_name(vmname)
|
vm = qvm_collection.get_vm_by_name(vmname)
|
||||||
if vm is None:
|
if vm is None:
|
||||||
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system!".format(vmname)
|
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system!".format(vmname)
|
||||||
exit(1)
|
exit(1)
|
||||||
vms_list.append(vm)
|
vms_list.append(vm)
|
||||||
|
|
||||||
# Check VMs network dependencies
|
# Check VMs network dependencies
|
||||||
if not options.force:
|
if not options.force:
|
||||||
|
Loading…
Reference in New Issue
Block a user