Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: image_to_live.sh

Issue 6594089: Wait until we can initiate contact with the update engine before starting update. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: image_to_live.sh
diff --git a/image_to_live.sh b/image_to_live.sh
index c2aafc3c639ffa2c3b5126efe24ef62139bd3753..1eaa1ea60905392a63f1a9f71f34d8067ba981de 100755
--- a/image_to_live.sh
+++ b/image_to_live.sh
@@ -305,12 +305,30 @@ function status_thread {
done
}
+# Pings the update_engine to see if it responds or a max timeout is reached.
+# Returns 1 if max timeout is reached.
+function wait_until_update_engine_is_ready {
+ local wait_timeout=1
+ local max_timeout=60
+ local time_elapsed=0
+ while ! get_update_var CURRENT_OP > /dev/null; do
+ sleep ${wait_timeout}
+ time_elapsed=$(( time_elapsed + wait_timeout ))
+ echo -n "."
+ if [ ${time_elapsed} -gt ${max_timeout} ]; then
+ return 1
+ fi
+ done
+}
function run_auto_update {
# Truncate the update log so our log file is clean.
truncate_update_log
local update_args="$(get_update_args "$(get_devserver_url)")"
+ info "Waiting to initiate contact with the update_engine."
+ wait_until_update_engine_is_ready || die "Could not contact update engine."
+
info "Starting update using args ${update_args}"
# Sets up a secondary thread to track the update progress.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698