crostestutils: Fix recover_duts error handling.
Make the recover_duts check_ethernet hook just run dbus-send
immediately in the background. The script previously ran
dbus-send and reboot in a subshell with "set -e" still
active, which would've resulted in reboot not being called
if dbus-send failed.
BUG=chromium:805051
TEST=made the script's checks fail and verified that it
successfully reboots a DUT both when powerd is running
and when it isn't
Change-Id: I38dfc95b555e69044b895d0bc6459bb8f6ba9ed1
Reviewed-on: https://chromium-review.googlesource.com/923203
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
diff --git a/recover_duts/hooks/check_ethernet.hook b/recover_duts/hooks/check_ethernet.hook
index 885e3cb..e0cfa05 100755
--- a/recover_duts/hooks/check_ethernet.hook
+++ b/recover_duts/hooks/check_ethernet.hook
@@ -271,12 +271,11 @@
# Give powerd a chance to reboot via the standard path (and log messages that
# are helpful for debugging) before calling 'reboot' directly.
- (sleep 5;
- dbus-send --system --type=method_call --dest=org.chromium.PowerManager \
+ dbus-send --system --type=method_call --dest=org.chromium.PowerManager \
/org/chromium/PowerManager org.chromium.PowerManager.RequestRestart \
- int32:2 string:'recover_duts check_ethernet hook failed';
- sleep 30;
- reboot) &
+ int32:2 string:'recover_duts check_ethernet hook failed' &
+ sleep 30
+ reboot
return 1
}