Parse and expose end-of-life flag.
Omaha update or noupdate response can include _key=value pairs with
arbitrary data. One of those key can be "_eol" with the one of the
values "supported", "security-only" or "eol" which notifies the device
the end-of-life status of the device with respect to updates. This
information is now exposed via GetEolStatus() to the client so it
can be properly displayed in the UI.
Bug: 27924505
TEST=Added unittest. Run `update_engine_client --eol_status` on link.
Change-Id: Icc15f25b4d0b19cc894f5afc52ac7c43c7818982
diff --git a/update_engine_client.cc b/update_engine_client.cc
index 6ade12c..55d7e64 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -32,10 +32,12 @@
#include "update_engine/client.h"
#include "update_engine/common/error_code.h"
#include "update_engine/common/error_code_utils.h"
+#include "update_engine/omaha_utils.h"
#include "update_engine/status_update_handler.h"
#include "update_engine/update_status.h"
#include "update_engine/update_status_utils.h"
+using chromeos_update_engine::EolStatus;
using chromeos_update_engine::ErrorCode;
using chromeos_update_engine::UpdateStatusToString;
using chromeos_update_engine::utils::ErrorCodeToString;
@@ -273,6 +275,7 @@
DEFINE_bool(prev_version, false,
"Show the previous OS version used before the update reboot.");
DEFINE_bool(last_attempt_error, false, "Show the last attempt error.");
+ DEFINE_bool(eol_status, false, "Show the current end-of-life status.");
// Boilerplate init commands.
base::CommandLine::Init(argc_, argv_);
@@ -534,6 +537,16 @@
}
}
+ if (FLAGS_eol_status) {
+ int eol_status;
+ if (!client_->GetEolStatus(&eol_status)) {
+ LOG(ERROR) << "Error getting the end-of-life status.";
+ } else {
+ EolStatus eol_status_code = static_cast<EolStatus>(eol_status);
+ printf("EOL_STATUS=%s\n", EolStatusToString(eol_status_code));
+ }
+ }
+
return 0;
}