Fixup upgrades, which miss install of psutil package

This commit is contained in:
James Page 2014-10-07 09:37:20 +01:00
parent 8583ad0d19
commit a604212425
3 changed files with 17 additions and 1 deletions

View File

@ -24,7 +24,11 @@ from charmhelpers.core.hookenv import (
relation_set,
)
from charmhelpers.fetch import apt_install, apt_update
from charmhelpers.fetch import (
apt_install,
apt_update,
filter_installed_packages
)
from charmhelpers.core.host import restart_on_change
from charmhelpers.payload.execd import execd_preinstall
@ -62,6 +66,11 @@ def config_changed():
save_script_rc()
@hooks.hook('upgrade-charm')
def upgrade_charm():
apt_install(filter_installed_packages(PACKAGES), fatal=True)
@hooks.hook()
def swift_storage_relation_joined():
devs = [os.path.basename(dev) for dev in determine_block_devices()]

1
hooks/upgrade-charm Symbolic link
View File

@ -0,0 +1 @@
swift_storage_hooks.py

View File

@ -24,6 +24,7 @@ TO_PATCH = [
# charmhelpers.core.host
'apt_update',
'apt_install',
'filter_installed_packages',
# charmehelpers.contrib.openstack.utils
'configure_installation_source',
'openstack_upgrade_available',
@ -71,6 +72,11 @@ class SwiftStorageRelationsTests(CharmTestCase):
self.assertTrue(self.do_openstack_upgrade.called)
self.assertTrue(self.CONFIGS.write_all.called)
def test_upgrade_charm(self):
self.filter_installed_packages.return_value = ['python-psutil']
hooks.upgrade_charm()
self.apt_install.assert_called_with(['python-psutil'], fatal=True)
def test_storage_joined_single_device(self):
self.determine_block_devices.return_value = ['/dev/vdb']
hooks.swift_storage_relation_joined()