diff --git a/hooks/neutron_utils.py b/hooks/neutron_utils.py index b8056599..6506155c 100644 --- a/hooks/neutron_utils.py +++ b/hooks/neutron_utils.py @@ -250,6 +250,13 @@ def get_packages(): packages.append('openswan') if source >= 'kilo': packages.append('python-neutron-fwaas') + if source >= 'liberty': + # Switch out mysql driver + packages.remove('python-mysqldb') + packages.append('python-pymysql') + # Switch out to actual metering agent package + packages.remove('neutron-plugin-metering-agent') + packages.append('neutron-metering-agent') packages.extend(determine_l3ha_packages()) if git_install_requested(): diff --git a/unit_tests/test_neutron_hooks.py b/unit_tests/test_neutron_hooks.py index e20c0341..89978469 100644 --- a/unit_tests/test_neutron_hooks.py +++ b/unit_tests/test_neutron_hooks.py @@ -162,7 +162,7 @@ class TestQuantumHooks(CharmTestCase): self.assertTrue(_amqp_joined.called) self.assertTrue(_amqp_nova_joined.called) self.assertTrue(_zmq_joined.called) - self.create_sysctl.assert_called() + self.assertTrue(self.create_sysctl.called) @patch.object(hooks, 'git_install_requested') def test_config_changed_upgrade(self, git_requested): @@ -235,7 +235,7 @@ class TestQuantumHooks(CharmTestCase): self.assertTrue(_amqp_joined.called) self.assertTrue(_amqp_nova_joined.called) self.assertTrue(_zmq_joined.called) - self.create_sysctl.assert_called() + self.assertTrue(self.create_sysctl.called) def test_upgrade_charm(self): _install = self.patch('install') diff --git a/unit_tests/test_neutron_utils.py b/unit_tests/test_neutron_utils.py index acb571ca..72bcd4a4 100644 --- a/unit_tests/test_neutron_utils.py +++ b/unit_tests/test_neutron_utils.py @@ -158,6 +158,17 @@ class TestQuantumUtils(CharmTestCase): self.get_os_codename_install_source.return_value = 'kilo' self.assertTrue('python-neutron-fwaas' in neutron_utils.get_packages()) + @patch.object(neutron_utils, 'git_install_requested') + def test_get_packages_ovs_liberty(self, git_requested): + git_requested.return_value = False + self.config.return_value = 'ovs' + self.get_os_codename_install_source.return_value = 'liberty' + packages = neutron_utils.get_packages() + self.assertTrue('neutron-metering-agent' in packages) + self.assertFalse('neutron-plugin-metering-agent' in packages) + self.assertFalse('python-mysqldb' in packages) + self.assertTrue('python-pymysql' in packages) + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_l3ha(self, git_requested): git_requested.return_value = False