From 80bb373a50acb8303e88f59178e53b720ff123a0 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Thu, 11 Sep 2014 13:28:27 +0200 Subject: [PATCH] labs: simplify wait_for_autofiles logic Refactoring to make the control flow easier to understand. Change-Id: Id38fd1c06ba51ec65577e7c6e7d7caf67acff666 --- labs/lib/osbash/functions.host | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/labs/lib/osbash/functions.host b/labs/lib/osbash/functions.host index 8535971e..32ad4538 100644 --- a/labs/lib/osbash/functions.host +++ b/labs/lib/osbash/functions.host @@ -180,7 +180,6 @@ function process_begin_files { # Wait until all autofiles are processed (indicated by a "$STATUS_DIR/done" # file created either by osbashauto or ssh_process_autostart) function wait_for_autofiles { - local auto_done=false shopt -s nullglob ${WBATCH:-:} wbatch_wait_auto @@ -188,18 +187,16 @@ function wait_for_autofiles { ${OSBASH:+:} autostart_reset ${OSBASH:+:} return 0 - until $auto_done ; do - if [ -f "$STATUS_DIR/done" ]; then - auto_done=true - rm "$STATUS_DIR/done" - # Return only after checking for remaining *.sh.begin files - fi + until [ -f "$STATUS_DIR/done" ]; do # Note: begin files (created by indicate_current_auto) are only visible # if the STATUS_DIR directory is shared between host and VM ${WBATCH:-:} process_begin_files echo >&2 -n . sleep 1 done + # Check for remaining *.sh.begin files + ${WBATCH:-:} process_begin_files + rm "$STATUS_DIR/done" echo }