From 9fb764dcb2fd0883727cb65dbb151b72165d8d38 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 15 Dec 2017 15:28:27 -0500 Subject: [PATCH] Wait for zypper processes to finish before calling zypper again Fixes an issue where the bootstrap script bails out if there is a zypper process running already on the machine to be bootstrapped. This can happen when a machine has been modified to use zypper in a boot command. We need to wait for the process to finish before calling the next zypper command. Otherwise, the following error occurs: ``` System management is locked by the application with pid (zypper). ``` --- bootstrap-salt.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a97fada..5f28f39 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5456,6 +5456,13 @@ __version_lte() { } __zypper() { + # Check if any zypper process is running before calling zypper again. + # This is useful when a zypper call is part of a boot process and will + # wait until the zypper process is finished, such as on AWS AMIs. + while pgrep -l zypper; do + sleep 1 + done + zypper --non-interactive "${@}"; return $? }