update_engine: Place enterprise rollback save marker file
- There are now two types of rollback. One that does a full powerwash
and one that save some system state.
- When an enterprise rollback powerwash is scheduled, place a marker
file to tell the shutdown process to save data before rebooting.
- This lets rollback preserve additional data over a powerwash that
can be restored later.
- Change a few places that were using is_rollback to save_rollback_data
to be explicit.
BUG=chromium:955463
TEST=unittests
Change-Id: I9f18319e711e425a6e712dd319e03bcc6ddd0a1b
Reviewed-on: https://chromium-review.googlesource.com/1414030
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index a782b8f..cc3843d 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -57,9 +57,14 @@
CHECK(HasInputObject());
install_plan_ = GetInputObject();
- // Currently we're always powerwashing when rolling back.
+ // We always powerwash when rolling back, however policy can determine
+ // if this is a full/normal powerwash, or a special rollback powerwash
+ // that retains a small amount of system state such as enrollment and
+ // network configuration. In both cases all user accounts are deleted.
if (install_plan_.powerwash_required || install_plan_.is_rollback) {
- if (hardware_->SchedulePowerwash(install_plan_.is_rollback)) {
+ bool save_rollback_data =
+ install_plan_.is_rollback && install_plan_.rollback_data_save_requested;
+ if (hardware_->SchedulePowerwash(save_rollback_data)) {
powerwash_scheduled_ = true;
} else {
return CompletePostinstall(ErrorCode::kPostinstallPowerwashError);