-
Notifications
You must be signed in to change notification settings - Fork 12
/
upgrade.sh
executable file
·66 lines (56 loc) · 1.92 KB
/
upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2022
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o nounset
set -o pipefail
set -o errexit
if [[ ${OS_DEBUG:-false} == "true" ]]; then
set -o xtrace
fi
source defaults.env
source commons.sh
# shellcheck disable=SC1091
source /etc/os-release || source /usr/lib/os-release
function _print_state {
# PEP 370 -- Per user site-packages directory
[[ $PATH != *.local/bin* ]] && export PATH=$PATH:$HOME/.local/bin
if command -v openstack; then
echo "OpenStack client version"
openstack --version
echo "OpenStack service versions"
openstack versions show
fi
echo "OpenStack Kolla version"
pip freeze | grep kolla
if command -v docker; then
echo "OpenStack Kolla services"
sudo docker ps
fi
}
function _install_deps {
if ! command -v pip; then
# NOTE: Shorten link -> https://github.com/electrocucaracha/pkg-mgr_scripts
curl -fsSL http://bit.ly/install_pkg | PKG=pip bash
fi
echo "Upgrade OpenStack services to ${OPENSTACK_RELEASE} release"
# NOTE: Uninstall mitogen given that it's only supported in some Ansible versions (2.13.x)
pip uninstall mitogen --yes
pip install --ignore-installed --no-warn-script-location --requirement "requirements/${OPENSTACK_RELEASE}/${ID,,}_${VERSION_ID%.*}.txt"
setup_ansible
}
function main {
_print_state
trap _print_state EXIT
_install_deps
set_values
run_kolla_actions pull upgrade
}
if [[ ${__name__:-"__main__"} == "__main__" ]]; then
main
fi