xci: scripts: vm: start-new-vm.sh: Re-arrange debug messages 31/52331/2
authorMarkos Chandras <mchandras@suse.de>
Mon, 19 Feb 2018 20:28:31 +0000 (20:28 +0000)
committerMarkos Chandras <mchandras@suse.de>
Tue, 20 Feb 2018 07:18:48 +0000 (07:18 +0000)
This also improves (again!) the check for parallel packages managers
to print some useful messages for debugging.

Change-Id: I7756db80aa3ed42cd3ef37293f7116b5a9c150c1
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/scripts/vm/start-new-vm.sh

index 70dc4ef..6a87714 100755 (executable)
@@ -100,7 +100,6 @@ sudo virsh destroy ${VM_NAME} || true
 sudo virsh undefine ${VM_NAME} || true
 
 source /etc/os-release
-echo "Installing host (${ID,,}) dependencies..."
 # check we can run sudo
 if ! sudo -n "true"; then
        echo ""
@@ -126,10 +125,18 @@ case ${ID,,} in
                ;;
 esac
 
+echo "Checking for running package manager instance..."
 while true; do
-       pgrep -fa "${pkg_mgr_cmd%*install*}" 2>&1 && sleep 60 || break
+       _pkg_mgr_proc=$(pgrep -f "${pkg_mgr_cmd%*install*}")
+       if [[ -n ${_pkg_mgr_proc} ]]; then
+               echo "Wainting for process ${_pkg_mgr_proc} to finish..."
+               sleep 60
+       else
+               break
+       fi
 done
 
+echo "Installing host (${ID,,}) dependencies..."
 eval ${pkg_mgr_cmd} &> /dev/null
 
 echo "Ensuring libvirt and docker services are running..."