3 # A heat-config-script which runs yum update during a stack-update.
5 # deploy_action - yum will only be run if this is UPDATE
6 # update_identifier - yum will only run for previously unused values of update_identifier
7 # command - yum sub-command to run, defaults to "update"
8 # command_arguments - yum command arguments, defaults to ""
10 echo "Started yum_update.sh on server $deploy_server_id at `date`"
11 echo -n "false" > $heat_outputs_path.update_managed_packages
13 if [[ -z "$update_identifier" ]]; then
14 echo "Not running due to unset update_identifier"
18 timestamp_dir=/var/lib/overcloud-yum-update
19 mkdir -p $timestamp_dir
21 command_arguments=${command_arguments:-}
22 # exclude upgrading packages that are handled by config management tooling
23 for exclude in $(cat /var/lib/tripleo/installed-packages/* | sort -u); do
24 command_arguments="$command_arguments --exclude $exclude"
27 # sanitise to remove unusual characters
28 update_identifier=${update_identifier//[^a-zA-Z0-9-_]/}
30 timestamp_file="$timestamp_dir/$update_identifier"
31 if [[ -a "$timestamp_file" ]]; then
32 echo "Not running for already-run timestamp \"$update_identifier\""
35 touch "$timestamp_file"
37 command=${command:-update}
38 full_command="yum -y $command $command_arguments"
39 echo "Running: $full_command"
41 result=$($full_command)
44 echo "yum return code: $return_code"
46 echo -n "true" > $heat_outputs_path.update_managed_packages
48 echo "Finished yum_update.sh on server $deploy_server_id at `date`"