Fix rollback crash while previous rollback is in progress.
The CHECK in Rollback is wrong. We should not be crashing the update_engine
just because we have a previous rollback in progress. This CL changes the
CHECK to a if/else and cleans up the Rollback() logic to be easier to follow
and removes a redundant check for partitions (since CanRollback already
covers this problem).
This CL also cleans up a couple rollback-related unittests.
BUG=chromium:356975
TEST=unittests + on device
Change-Id: Iee8de65eabcddd1dbe6c6413e33a15bf75302260
Reviewed-on: https://chromium-review.googlesource.com/192909
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/dbus_service.cc b/dbus_service.cc
index 03bc602..230e6d5 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -182,7 +182,7 @@
GError **error) {
LOG(INFO) << "Attempting rollback to non-active partitions.";
- if (!self->system_state_->update_attempter()->Rollback(powerwash, NULL)) {
+ if (!self->system_state_->update_attempter()->Rollback(powerwash)) {
// TODO(dgarrett): Give a more specific error code/reason.
log_and_set_response_error(error,
UPDATE_ENGINE_SERVICE_ERROR_FAILED,
@@ -198,7 +198,7 @@
GError **error)
{
bool can_rollback = self->system_state_->update_attempter()->CanRollback();
- LOG(INFO) << "Checking for a rollback partition. Result: " << can_rollback;
+ LOG(INFO) << "Checking to see if we can rollback . Result: " << can_rollback;
*out_can_rollback = can_rollback;
return TRUE;
}