Ensure py3 pkgs installed on series-upgrade
On series-upgrade the g-s-s stopped syncing due python packages required by the sync file (that is run in the context of the unit, rather than the charm) not being present. I believe they may have been removed during the series-upgrade when unused packages were removed. This patch ensures that on both upgrade and series upgrade, all the packages that are needed are installed. Change-Id: I8dfa9b0111fa3f204364e2c0833595bf8b219a7c Closes-Bug: #1934306
This commit is contained in:
parent
45a1d02716
commit
787a9c5ae9
|
@ -350,7 +350,7 @@ def config_changed():
|
|||
config.save()
|
||||
|
||||
|
||||
@hooks.hook('upgrade-charm')
|
||||
@hooks.hook('upgrade-charm.real')
|
||||
def upgrade_charm():
|
||||
install()
|
||||
update_nrpe_config()
|
||||
|
@ -380,7 +380,7 @@ def pre_series_upgrade():
|
|||
"Set complete when finished.")
|
||||
|
||||
|
||||
@hooks.hook('post-series-upgrade')
|
||||
@hooks.hook('post-series-upgrade.real')
|
||||
def post_series_upgrade():
|
||||
hookenv.log("Running complete series upgrade hook", "INFO")
|
||||
# In order to indicate the step of the series upgrade process for
|
||||
|
@ -388,6 +388,7 @@ def post_series_upgrade():
|
|||
# upgrading states.
|
||||
clear_unit_paused()
|
||||
clear_unit_upgrading()
|
||||
install()
|
||||
hookenv.status_set("active", "")
|
||||
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
hooks.py
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash -e
|
||||
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
|
||||
# by default; when series-upgrading, ensure that the python3 packages are
|
||||
# installed.
|
||||
|
||||
declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml')
|
||||
|
||||
check_and_install() {
|
||||
pkg="${1}-${2}"
|
||||
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
|
||||
apt-get -y install ${pkg}
|
||||
fi
|
||||
}
|
||||
|
||||
PYTHON="python3"
|
||||
|
||||
for dep in ${DEPS[@]}; do
|
||||
check_and_install ${PYTHON} ${dep}
|
||||
done
|
||||
|
||||
exec ./hooks/upgrade-charm.real
|
|
@ -0,0 +1 @@
|
|||
hooks.py
|
|
@ -1 +0,0 @@
|
|||
hooks.py
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash -e
|
||||
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
|
||||
# by default; when upgrading, ensure that the python3 packages are installed.
|
||||
|
||||
declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml')
|
||||
|
||||
check_and_install() {
|
||||
pkg="${1}-${2}"
|
||||
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
|
||||
apt-get -y install ${pkg}
|
||||
fi
|
||||
}
|
||||
|
||||
PYTHON="python3"
|
||||
|
||||
for dep in ${DEPS[@]}; do
|
||||
check_and_install ${PYTHON} ${dep}
|
||||
done
|
||||
|
||||
exec ./hooks/upgrade-charm.real
|
|
@ -0,0 +1 @@
|
|||
hooks.py
|
Loading…
Reference in New Issue