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:
parent
5f6058e843
commit
392ed152dc
@ -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')
|
||||
|
@ -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):
|
||||
|
@ -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([
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user