Report usage of StopAutoUpdate policy in borgmon charts
Omaha already has an event result for reporting UpdateDeferred (9)
which shows up in the borgman charts. In order to use that we should
perform a normal updatecheck without the updatedisabled set to true and
then discard the response with event type UpdateComplete (3) but with
event result UpdateDeferred (9).
BUG=28645: Report StopAutoUpdate enforcement in Borgmon charts for Omaha
TEST=Tested success, error and deferred cases on my zgb.
Change-Id: I27cb4465ea9876b39edaff3b747ada44a4f875d4
Reviewed-on: https://gerrit.chromium.org/gerrit/19112
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index c23135b..214f21a 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -602,6 +602,22 @@
return;
}
+ // Classify the code to generate the appropriate result so that
+ // the Borgmon charts show up the results correctly.
+ // Do this before calling GetErrorCodeForAction which could potentially
+ // augment the bit representation of code and thus cause no matches for
+ // the switch cases below.
+ OmahaEvent::Result event_result;
+ switch (code) {
+ case kActionCodeOmahaUpdateIgnoredPerPolicy:
+ case kActionCodeOmahaUpdateDeferredPerPolicy:
+ event_result = OmahaEvent::kResultUpdateDeferred;
+ break;
+ default:
+ event_result = OmahaEvent::kResultError;
+ break;
+ }
+
code = GetErrorCodeForAction(action, code);
fake_update_success_ = code == kActionCodePostinstallBootedFromFirmwareB;
@@ -613,8 +629,9 @@
response_handler_action_->install_plan().is_resume) {
code = static_cast<ActionExitCode>(code | kActionCodeResumedFlag);
}
+
error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete,
- OmahaEvent::kResultError,
+ event_result,
code));
}