diff --git a/hooks/horizon_utils.py b/hooks/horizon_utils.py index 86cf32e9..efc1cda3 100644 --- a/hooks/horizon_utils.py +++ b/hooks/horizon_utils.py @@ -41,6 +41,7 @@ from charmhelpers.contrib.openstack.utils import ( is_unit_paused_set, os_application_version_set, CompareOpenStackReleases, + reset_os_release, ) from charmhelpers.contrib.python.packages import ( pip_install, @@ -304,6 +305,8 @@ def do_openstack_upgrade(configs): ] apt_update(fatal=True) apt_upgrade(options=dpkg_opts, fatal=True, dist=True) + reset_os_release() + apt_install(determine_packages(), fatal=True) # set CONFIGS to load templates from new release configs.set_release(openstack_release=new_os_rel) diff --git a/unit_tests/test_horizon_utils.py b/unit_tests/test_horizon_utils.py index be6715c0..e60aacae 100644 --- a/unit_tests/test_horizon_utils.py +++ b/unit_tests/test_horizon_utils.py @@ -28,11 +28,13 @@ TO_PATCH = [ 'get_os_codename_install_source', 'apt_update', 'apt_upgrade', + 'apt_install', 'configure_installation_source', 'log', 'cmp_pkgrevno', 'os_release', 'os_application_version_set', + 'reset_os_release', ] openstack_origin_git = \ @@ -110,10 +112,12 @@ class TestHorizohorizon_utils(CharmTestCase): ]) self.assertEquals(horizon_utils.restart_map(), ex_map) - def test_do_openstack_upgrade(self): + @patch.object(horizon_utils, 'determine_packages') + def test_do_openstack_upgrade(self, determine_packages): self.config.return_value = 'cloud:precise-havana' self.get_os_codename_install_source.return_value = 'havana' configs = MagicMock() + determine_packages.return_value = ['testpkg'] horizon_utils.do_openstack_upgrade(configs) configs.set_release.assert_called_with(openstack_release='havana') self.assertTrue(self.log.called) @@ -124,6 +128,8 @@ class TestHorizohorizon_utils(CharmTestCase): ] self.apt_upgrade.assert_called_with(options=dpkg_opts, dist=True, fatal=True) + self.apt_install.assert_called_with(['testpkg'], fatal=True) + self.reset_os_release.assert_called() self.configure_installation_source.assert_called_with( 'cloud:precise-havana' )