The exitstatus on the process is a gevent.AsyncResult
(not an int). Use the try/except pattern for handling
errors instead.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
restart_daemon(ctx, config, cmd[1], cmd[2], *cmd[3:])
proc.stdin.writelines(['restarted\n'])
proc.stdin.flush()
- tor.wait([proc])
- e = proc.exitstatus
- if e != 0:
- raise Exception('restart task got non-zero exit status {d} from script: {s}'.format(d=e, s=c))
+ try:
+ proc.exitstatus.get()
+ except tor.CommandFailedError:
+ raise Exception('restart task got non-zero exit status from script: {s}'.format(s=c))
finally:
log.info('Finishing %s on %s...', task, role)
remote.run(