update_engine: Log when EOL date is set + retrieved
autoupdate_EOL autotests seems to fail and return a default EOL date
value of -9999. This logging helps pinpoint whether prefs are the
culprit.
BUG=chromium:1090283
TEST=FEATURES=test emerge-$B update_engine update_engine-client
Change-Id: If2feb4841d2642af89dac94e699a30a7ee2fb002
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2227031
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 8728f72..86d4b93 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -1366,11 +1366,13 @@
// If EOL date attribute is not sent, don't delete the old persisted EOL
// date information.
auto eol_date_attr = attrs.find(kAttrEolDate);
- if (eol_date_attr != attrs.end() &&
- !system_state_->prefs()->SetString(kPrefsOmahaEolDate,
- eol_date_attr->second)) {
- LOG(ERROR) << "Setting EOL date failed.";
- return false;
+ if (eol_date_attr != attrs.end()) {
+ const auto& eol_date = eol_date_attr->second;
+ if (!system_state_->prefs()->SetString(kPrefsOmahaEolDate, eol_date)) {
+ LOG(ERROR) << "Setting EOL date failed.";
+ return false;
+ }
+ LOG(INFO) << "Set EOL date to " << eol_date;
}
return true;
}