Adds check for existing yum process during the legacy minor update

Checks for an existing /var/run/yum.pid and exit 1 with an error
message saying why.

Change-Id: I374eeb4164a8007ae67fea2796eac109fffdef97
Closes-Bug: 1704131
(cherry picked from commit 839c0b1116)
This commit is contained in:
marios 2017-07-13 16:11:13 +03:00 committed by Marios Andreou
parent 36a16de283
commit ebd6c013b8
2 changed files with 15 additions and 1 deletions

View File

@ -345,3 +345,15 @@ function update_network() {
# special case https://bugs.launchpad.net/tripleo/+bug/1635205 +bug/1669714
special_case_ovs_upgrade_if_needed
}
# https://bugs.launchpad.net/tripleo/+bug/1704131 guard against yum update
# waiting for an existing process until the heat stack time out
function check_for_yum_lock {
if [[ -f /var/run/yum.pid ]] ; then
ERR="ERROR existing yum.pid detected - can't continue! Please ensure
there is no other package update process for the duration of the minor update
worfklow. Exiting."
echo $ERR
exit 1
fi
}

View File

@ -99,6 +99,7 @@ if [[ "$pacemaker_status" == "active" ]] ; then
else
update_network
echo "Upgrading openstack-puppet-modules and its dependencies"
check_for_yum_lock
yum -q -y update openstack-puppet-modules
yum deplist openstack-puppet-modules | awk '/dependency/{print $2}' | xargs yum -q -y update
echo "Upgrading other packages is handled by config management tooling"
@ -108,8 +109,9 @@ fi
command=${command:-update}
full_command="yum -q -y $command $command_arguments"
echo "Running: $full_command"
echo "Running: $full_command"
check_for_yum_lock
result=$($full_command)
return_code=$?
echo "$result"