Use provided omaha_url and app_version on non-interactive update.
The D-Bus API allows to start a non-interactive update check and pass
the Omaha URL and the app_version to be used. If updates from other
Omaha servers are allowed (like in non-official builds or dev-mode with
debug options enabled) these provided options would normally be used,
except for non-interactive update.
This patch uses the provided url and app_version even for
non-interactive updates.
Bug: 26937101
TEST=Ran `update_engine_client --nointeractive --check_for_update --omaha_url=http://127.0.0.1:1234` on edison.
Change-Id: I8a1e7fdc6ede434537ee028ef59e3eee29a44edc
diff --git a/update_attempter.cc b/update_attempter.cc
index cfd2425..7194402 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -881,14 +881,12 @@
<< (params.is_interactive ? "interactive" : "periodic")
<< " update.";
- string app_version, omaha_url;
- if (params.is_interactive) {
- app_version = forced_app_version_;
- omaha_url = forced_omaha_url_;
- }
-
- Update(app_version, omaha_url, params.target_channel,
+ Update(forced_app_version_, forced_omaha_url_, params.target_channel,
params.target_version_prefix, false, params.is_interactive);
+ // Always clear the forced app_version and omaha_url after an update attempt
+ // so the next update uses the defaults.
+ forced_app_version_.clear();
+ forced_omaha_url_.clear();
} else {
LOG(WARNING)
<< "Update check scheduling failed (possibly timed out); retrying.";