From 17709dcce9dbee2ea138f1cb1c8f0ca467d88973 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 25 Mar 2013 16:23:26 +0100 Subject: [PATCH] qvm-tools: qvm-run: eturn exitcode!=0 if any command failed --- qvm-tools/qvm-run | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qvm-tools/qvm-run b/qvm-tools/qvm-run index b8241de6..a474a855 100755 --- a/qvm-tools/qvm-run +++ b/qvm-tools/qvm-run @@ -58,19 +58,19 @@ def vm_run_cmd(vm, cmd, options): if str(err).startswith("There are other VMs connected"): print >> sys.stderr, "Shutdown them first or use --force switch" exit(1) - return + return 0 if options.pause: if options.verbose: print >> sys.stderr, "Pausing VM: '{0}'...".format(vm.name) vm.pause() - return + return 0 if options.unpause: if options.verbose: print >> sys.stderr, "UnPausing VM: '{0}'...".format(vm.name) vm.unpause() - return + return 0 if options.verbose: print >> sys.stderr, "Running command on VM: '{0}'...".format(vm.name) @@ -193,8 +193,10 @@ def main(): exit(1) vms_list.append(vm) + retcode = 0 for vm in vms_list: - vm_run_cmd(vm, cmdstr, options) + r = vm_run_cmd(vm, cmdstr, options) + retcode = max(r, retcode) if options.wait_for_shutdown: if options.verbose: @@ -217,5 +219,6 @@ def main(): shutdown_counter += 1 time.sleep (1) exit (0) # there is no point in executing the other daemons in the case of --wait + exit(retcode) main()