Deal with py2-py3 migration during charm upgrade
On charm upgrade the charm may switch to py3 packages. If so, ensure the old py2 packages are purged after any new packages have been installed. If packages where removed during the upgrade, then restart all services to pickup any py2->py3 switches. Change-Id: I8a17f679e85448680ab0b1f5ae362ef7a65b035c Closes-Bug: 1803451
This commit is contained in:
@@ -123,6 +123,7 @@ from keystone_utils import (
|
||||
key_write,
|
||||
pause_unit_helper,
|
||||
resume_unit_helper,
|
||||
remove_old_packages,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
@@ -707,6 +708,7 @@ def configure_https():
|
||||
def upgrade_charm():
|
||||
status_set('maintenance', 'Installing apt packages')
|
||||
apt_install(filter_installed_packages(determine_packages()))
|
||||
packages_removed = remove_old_packages()
|
||||
|
||||
if run_in_apache():
|
||||
disable_unused_apache_sites()
|
||||
@@ -718,6 +720,11 @@ def upgrade_charm():
|
||||
|
||||
update_nrpe_config()
|
||||
|
||||
if packages_removed:
|
||||
log("Package purge detected, restarting services", "INFO")
|
||||
for s in services():
|
||||
service_restart(s)
|
||||
|
||||
if is_elected_leader(CLUSTER_RES):
|
||||
log('Cluster leader - ensuring endpoint configuration is up to '
|
||||
'date', level=DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user