Implement the update engine portion for new enterprise policies.
Enterprises need the ability to stop the auto updates and pin clients
to a given target version. This CL adds support for these features in
the update_engine.
BUG=27307: Implement StopAutoUpdate based on enterprise policy
TEST=Added new unit tests, manually tested all cases on ZGB.
CQ-DEPEND=I523c3f67e0cb07fd24744dc0a30382ff2fe2128a
Change-Id: Id576401afc6d2c93f0e9ece7c6c0ddcf4b1bc00d
Reviewed-on: https://gerrit.chromium.org/gerrit/17867
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 31bc47b..c23135b 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -168,8 +168,14 @@
// If the release_track is specified by policy, that takes precedence.
string release_track;
- if (policy_provider_->device_policy_is_loaded())
- policy_provider_->GetDevicePolicy().GetReleaseChannel(&release_track);
+ if (policy_provider_->device_policy_is_loaded()) {
+ const policy::DevicePolicy& device_policy =
+ policy_provider_->GetDevicePolicy();
+ device_policy.GetReleaseChannel(&release_track);
+ device_policy.GetUpdateDisabled(&omaha_request_params_.update_disabled);
+ device_policy.GetTargetVersionPrefix(
+ &omaha_request_params_.target_version_prefix);
+ }
// Determine whether an alternative test address should be used.
string omaha_url_to_use = omaha_url;
@@ -178,12 +184,18 @@
LOG(INFO) << "using alternative server address: " << omaha_url_to_use;
}
- if (!omaha_request_params_.Init(app_version, omaha_url_to_use,
+ if (!omaha_request_params_.Init(app_version,
+ omaha_url_to_use,
release_track)) {
LOG(ERROR) << "Unable to initialize Omaha request device params.";
return;
}
+ LOG(INFO) << "update_disabled = "
+ << (omaha_request_params_.update_disabled ? "true" : "false")
+ << ", target_version_prefix = "
+ << omaha_request_params_.target_version_prefix;
+
obeying_proxies_ = true;
if (obey_proxies || proxy_manual_checks_ == 0) {
LOG(INFO) << "forced to obey proxies";