summaryrefslogtreecommitdiff
path: root/update_status_utils.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@google.com>2015-10-23 17:37:27 -0700
committerAlex Deymo <deymo@google.com>2016-01-06 14:53:24 -0800
commitf7ead8100211e7a285b48b52f4a235647274ab6e (patch)
treeadc7a4b7f229ebbcd09e2030b27e272c17619a2a /update_status_utils.cc
parentd81584673de3c888bde40b473bb2685ba1c5cc2d (diff)
Implement update_engine weave commands
The new WeaveServiceInterface abstracs the registration and interaction with weave whenever present. The compilation and usage of weave is based on the BRILLO_USE_WEAVE flag. When enabled, update_engine registers the "_updater" component with methods to force-check for an update and change channels. Bug: 24386758 Bug: 24386768 Test: Deployed on edison, weave commands and state available online. Change-Id: Ic49111772e123b8a2b1971da92fe65785f186ccd
Diffstat (limited to 'update_status_utils.cc')
-rw-r--r--update_status_utils.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/update_status_utils.cc b/update_status_utils.cc
index ff039b8c..96858531 100644
--- a/update_status_utils.cc
+++ b/update_status_utils.cc
@@ -20,6 +20,21 @@
using update_engine::UpdateStatus;
+namespace {
+
+const char kWeaveStatusIdle[] = "idle";
+const char kWeaveStatusCheckingForUpdate[] = "checkingForUpdate";
+const char kWeaveStatusUpdateAvailable[] = "updateAvailable";
+const char kWeaveStatusDownloading[] = "downloading";
+const char kWeaveStatusVerifying[] = "verifying";
+const char kWeaveStatusFinalizing[] = "finalizing";
+const char kWeaveStatusUpdatedNeedReboot[] = "updatedNeedReboot";
+const char kWeaveStatusReportingErrorEvent[] = "reportingErrorEvent";
+const char kWeaveStatusAttemptingRollback[] = "attemptingRollback";
+const char kWeaveStatusDisabled[] = "disabled";
+
+} // namespace
+
namespace chromeos_update_engine {
const char* UpdateStatusToString(const UpdateStatus& status) {
@@ -50,6 +65,34 @@ const char* UpdateStatusToString(const UpdateStatus& status) {
return nullptr;
}
+const char* UpdateStatusToWeaveStatus(const UpdateStatus& status) {
+ switch (status) {
+ case UpdateStatus::IDLE:
+ return kWeaveStatusIdle;
+ case UpdateStatus::CHECKING_FOR_UPDATE:
+ return kWeaveStatusCheckingForUpdate;
+ case UpdateStatus::UPDATE_AVAILABLE:
+ return kWeaveStatusUpdateAvailable;
+ case UpdateStatus::DOWNLOADING:
+ return kWeaveStatusDownloading;
+ case UpdateStatus::VERIFYING:
+ return kWeaveStatusVerifying;
+ case UpdateStatus::FINALIZING:
+ return kWeaveStatusFinalizing;
+ case UpdateStatus::UPDATED_NEED_REBOOT:
+ return kWeaveStatusUpdatedNeedReboot;
+ case UpdateStatus::REPORTING_ERROR_EVENT:
+ return kWeaveStatusReportingErrorEvent;
+ case UpdateStatus::ATTEMPTING_ROLLBACK:
+ return kWeaveStatusAttemptingRollback;
+ case UpdateStatus::DISABLED:
+ return kWeaveStatusDisabled;
+ }
+
+ NOTREACHED();
+ return nullptr;
+}
+
bool StringToUpdateStatus(const std::string& s,
UpdateStatus* status) {
if (s == update_engine::kUpdateStatusIdle) {