Also update local package determination to include headers.

This commit is contained in:
Adam Gandelman 2013-10-11 14:46:05 -07:00
parent e5d6d4d12e
commit 0fb65a38b9
2 changed files with 17 additions and 4 deletions

View File

@ -15,8 +15,10 @@ from charmhelpers.contrib.openstack.utils import (
get_os_codename_install_source,
get_os_codename_package
)
import charmhelpers.contrib.openstack.context as context
import charmhelpers.contrib.openstack.templating as templating
from charmhelpers.contrib.openstack.neutron import headers_package
from quantum_contexts import (
CORE_PLUGIN, OVS, NVP,
NEUTRON, QUANTUM,
@ -97,10 +99,15 @@ EARLY_PACKAGES = {
def get_early_packages():
'''Return a list of package for pre-install based on configured plugin'''
if config('plugin') in EARLY_PACKAGES:
return EARLY_PACKAGES[config('plugin')]
pkgs = EARLY_PACKAGES[config('plugin')]
else:
return []
# ensure headers are installed build any required dkms packages
if [p for p in pkgs if 'dkms' in p]:
return pkgs + [headers_package()]
return pkgs
def get_packages():
'''Return a list of packages for install based on the configured plugin'''

View File

@ -1,6 +1,9 @@
from mock import MagicMock, call
import charmhelpers.contrib.openstack.templating as templating
templating.OSConfigRenderer = MagicMock()
import quantum_utils
from test_utils import (
@ -19,7 +22,8 @@ TO_PATCH = [
'log',
'add_bridge',
'add_bridge_port',
'networking_name'
'networking_name',
'headers_package',
]
@ -27,6 +31,7 @@ class TestQuantumUtils(CharmTestCase):
def setUp(self):
super(TestQuantumUtils, self).setUp(quantum_utils, TO_PATCH)
self.networking_name.return_value = 'neutron'
self.headers_package.return_value = 'linux-headers-2.6.18'
def tearDown(self):
# Reset cached cache
@ -44,8 +49,9 @@ class TestQuantumUtils(CharmTestCase):
def test_get_early_packages_ovs(self):
self.config.return_value = 'ovs'
self.assertEquals(quantum_utils.get_early_packages(),
['openvswitch-datapath-dkms'])
self.assertEquals(
quantum_utils.get_early_packages(),
['openvswitch-datapath-dkms', 'linux-headers-2.6.18'])
def test_get_early_packages_nvp(self):
self.config.return_value = 'nvp'