Fix error code for no update.
PayloadState does not get notified if there's no update, so the error
code will not be updated, move this to UpdateAttempter.
We were using the generic kError for no update, this change added a
new error code kNoUpdate for this, now update_engine_client will show
kNoUpdate instead of kSuccess or a random last error.
Bug: 36946608
Test: update_engine_client --check_for_update --follow
Change-Id: Ie1e94841788437140e0894dc2e73c314a7564108
(cherry picked from commit 89e24c11b406fe048382bdf1c89334e10417b899)
Reviewed-on: https://chromium-review.googlesource.com/1055857
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index 4b50072..4b51478 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -178,6 +178,8 @@
// Broadcasts the current status to all observers.
void BroadcastStatus();
+ ErrorCode GetAttemptErrorCode() const { return attempt_error_code_; }
+
// Returns the special flags to be added to ErrorCode values based on the
// parameters used in the current update attempt.
uint32_t GetErrorCodeFlags();
@@ -446,6 +448,9 @@
// HTTP server response code from the last HTTP request action.
int http_response_code_ = 0;
+ // The attempt error code when the update attempt finished.
+ ErrorCode attempt_error_code_ = ErrorCode::kSuccess;
+
// CPU limiter during the update.
CPULimiter cpu_limiter_;