Merge "Add replacepkgs to the manual ovs upgrade workaround and fix a typo"
[apex-tripleo-heat-templates.git] / extraconfig / tasks / major_upgrade_compute.sh
1 #!/bin/bash
2 #
3 # This delivers the compute upgrade script to be invoked as part of the tripleo
4 # major upgrade workflow.
5 #
6 set -eu
7
8 UPGRADE_SCRIPT=/root/tripleo_upgrade_node.sh
9
10 cat > $UPGRADE_SCRIPT << ENDOFCAT
11 ### DO NOT MODIFY THIS FILE
12 ### This file is automatically delivered to the compute nodes as part of the
13 ### tripleo upgrades workflow
14
15 set -eu
16
17 # pin nova to kilo (messaging +-1) for the nova-compute service
18
19 crudini  --set /etc/nova/nova.conf upgrade_levels compute $upgrade_level_nova_compute
20
21 # Special-case OVS for https://bugs.launchpad.net/tripleo/+bug/1635205
22 if [[ -n \$(rpm -q --scripts openvswitch | awk '/postuninstall/,/*/' | grep "systemctl.*try-restart") ]]; then
23     echo "Manual upgrade of openvswitch - restart in postun detected"
24     mkdir OVS_UPGRADE || true
25     pushd OVS_UPGRADE
26     echo "Attempting to downloading latest openvswitch with yumdownloader"
27     yumdownloader --resolve openvswitch
28     echo "Updating openvswitch with nopostun option"
29     rpm -U --replacepkgs --nopostun ./*.rpm
30     popd
31 else
32     echo "Skipping manual upgrade of openvswitch - no restart in postun detected"
33 fi
34
35 yum -y install python-zaqarclient  # needed for os-collect-config
36 yum -y update
37
38 ENDOFCAT
39
40 # ensure the permissions are OK
41 chmod 0755 $UPGRADE_SCRIPT
42