determine_packages should return a list of lists which the install hook should iterate over passing each inner list to apt_install in turn to ensure the dkms module gets install prior to openvswitch-switch trying to load it

This commit is contained in:
Liam Young 2014-06-24 15:04:51 +01:00
parent 5f6058e843
commit 392ed152dc
4 changed files with 6 additions and 9 deletions

View File

@ -31,7 +31,9 @@ CONFIGS = register_configs()
@hooks.hook()
def install():
apt_update()
apt_install(determine_packages(), fatal=True)
pkgs = determine_packages()
for pkg in pkgs:
apt_install(pkg, fatal=True)
@hooks.hook('neutron-plugin-relation-changed')

View File

@ -29,12 +29,7 @@ TEMPLATES = 'templates/'
def determine_packages():
ovs_pkgs = []
pkgs = neutron_plugin_attribute('ovs', 'packages',
'neutron')
for pkg in pkgs:
ovs_pkgs.extend(pkg)
return set(ovs_pkgs)
return neutron_plugin_attribute('ovs', 'packages', 'neutron')
def register_configs(release=None):

View File

@ -45,7 +45,7 @@ class NeutronOVSHooksTests(CharmTestCase):
def test_install_hook(self):
_pkgs = ['foo', 'bar']
self.determine_packages.return_value = _pkgs
self.determine_packages.return_value = [_pkgs]
self._call_hook('install')
self.apt_update.assert_called_with()
self.apt_install.assert_has_calls([

View File

@ -54,7 +54,7 @@ class TestNeutronOVSUtils(CharmTestCase):
_os_rel.return_value = 'trusty'
_head_pkgs.return_value = head_pkg
pkg_list = nutils.determine_packages()
expect = ['neutron-plugin-openvswitch-agent', head_pkg]
expect = [['neutron-plugin-openvswitch-agent'], [head_pkg]]
self.assertItemsEqual(pkg_list, expect)
def test_register_configs(self):