tools: pause/unpause/shutdown - don't stop on first failed VM
But still report a failure with exit code if any of them failed. QubesOS/qubes-issues#853
This commit is contained in:
parent
7baa7e4862
commit
795a06e400
@ -36,10 +36,15 @@ def main(args=None, app=None):
|
||||
'''
|
||||
|
||||
args = parser.parse_args(args, app=app)
|
||||
exit_code = 0
|
||||
for domain in args.domains:
|
||||
domain.pause()
|
||||
try:
|
||||
domain.pause()
|
||||
except (IOError, OSError, qubesmgmt.exc.QubesException) as e:
|
||||
exit_code = 1
|
||||
parser.print_error(str(e))
|
||||
|
||||
return 0
|
||||
return exit_code
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -28,6 +28,7 @@ import sys
|
||||
import time
|
||||
|
||||
import qubesmgmt.tools
|
||||
import qubesmgmt.exc
|
||||
|
||||
parser = qubesmgmt.tools.QubesArgumentParser(
|
||||
description=__doc__, vmname_nargs='+')
|
||||
@ -52,8 +53,10 @@ def main(args=None, app=None): # pylint: disable=missing-docstring
|
||||
args = parser.parse_args(args, app=app)
|
||||
|
||||
for vm in args.domains:
|
||||
if not vm.is_halted():
|
||||
try:
|
||||
vm.shutdown(force=args.force)
|
||||
except qubesmgmt.exc.QubesVMNotStartedError:
|
||||
pass
|
||||
|
||||
if not args.wait:
|
||||
return
|
||||
|
@ -37,10 +37,15 @@ def main(args=None, app=None):
|
||||
'''
|
||||
|
||||
args = parser.parse_args(args, app=app)
|
||||
exit_code = 0
|
||||
for domain in args.domains:
|
||||
domain.unpause()
|
||||
try:
|
||||
domain.unpause()
|
||||
except (IOError, OSError, qubesmgmt.exc.QubesException) as e:
|
||||
exit_code = 1
|
||||
parser.print_error(str(e))
|
||||
|
||||
return 0
|
||||
return exit_code
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user