Merge lp:~james-page/charms/trusty/neutron-api/lp-1469621 into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next

Proposed by James Page
Status: Merged
Merged at revision: 121
Proposed branch: lp:~james-page/charms/trusty/neutron-api/lp-1469621
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
Diff against target: 95 lines (+45/-1)
2 files modified
hooks/neutron_api_utils.py (+2/-1)
unit_tests/test_neutron_api_utils.py (+43/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/neutron-api/lp-1469621
Reviewer Review Type Date Requested Status
Ante Karamatić (community) Approve
Liam Young (community) Approve
Review via email: mp+263226@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #5670 neutron-api-next for james-page mp263226
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/5670/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #5302 neutron-api-next for james-page mp263226
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/5302/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #4853 neutron-api-next for james-page mp263226
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/4853/

Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve
Revision history for this message
Ante Karamatić (ivoks) wrote :

I can confirm that this branch does indeed solve bug 1469621

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/neutron_api_utils.py'
--- hooks/neutron_api_utils.py 2015-05-12 19:50:14 +0000
+++ hooks/neutron_api_utils.py 2015-06-29 11:35:24 +0000
@@ -48,6 +48,7 @@
48)48)
4949
50from charmhelpers.core.templating import render50from charmhelpers.core.templating import render
51from charmhelpers.contrib.hahelpers.cluster import is_elected_leader
5152
52import neutron_api_context53import neutron_api_context
5354
@@ -292,7 +293,7 @@
292 # set CONFIGS to load templates from new release293 # set CONFIGS to load templates from new release
293 configs.set_release(openstack_release=new_os_rel)294 configs.set_release(openstack_release=new_os_rel)
294 # Before kilo it's nova-cloud-controllers job295 # Before kilo it's nova-cloud-controllers job
295 if new_os_rel >= 'kilo':296 if is_elected_leader(CLUSTER_RES) and new_os_rel >= 'kilo':
296 stamp_neutron_database(cur_os_rel)297 stamp_neutron_database(cur_os_rel)
297 migrate_neutron_database()298 migrate_neutron_database()
298299
299300
=== modified file 'unit_tests/test_neutron_api_utils.py'
--- unit_tests/test_neutron_api_utils.py 2015-05-08 16:46:38 +0000
+++ unit_tests/test_neutron_api_utils.py 2015-06-29 11:35:24 +0000
@@ -33,6 +33,7 @@
33 'os_release',33 'os_release',
34 'pip_install',34 'pip_install',
35 'subprocess',35 'subprocess',
36 'is_elected_leader',
36]37]
3738
38openstack_origin_git = \39openstack_origin_git = \
@@ -190,6 +191,7 @@
190 def test_do_openstack_upgrade_juno(self, git_requested,191 def test_do_openstack_upgrade_juno(self, git_requested,
191 stamp_neutron_db, migrate_neutron_db):192 stamp_neutron_db, migrate_neutron_db):
192 git_requested.return_value = False193 git_requested.return_value = False
194 self.is_elected_leader.return_value = True
193 self.config.side_effect = self.test_config.get195 self.config.side_effect = self.test_config.get
194 self.test_config.set('openstack-origin', 'cloud:trusty-juno')196 self.test_config.set('openstack-origin', 'cloud:trusty-juno')
195 self.os_release.return_value = 'icehouse'197 self.os_release.return_value = 'icehouse'
@@ -227,6 +229,7 @@
227 stamp_neutron_db, migrate_neutron_db,229 stamp_neutron_db, migrate_neutron_db,
228 gsrc):230 gsrc):
229 git_requested.return_value = False231 git_requested.return_value = False
232 self.is_elected_leader.return_value = True
230 self.os_release.return_value = 'juno'233 self.os_release.return_value = 'juno'
231 self.config.side_effect = self.test_config.get234 self.config.side_effect = self.test_config.get
232 self.test_config.set('openstack-origin', 'cloud:trusty-kilo')235 self.test_config.set('openstack-origin', 'cloud:trusty-kilo')
@@ -256,6 +259,46 @@
256 stamp_neutron_db.assert_called_with('juno')259 stamp_neutron_db.assert_called_with('juno')
257 migrate_neutron_db.assert_called_with()260 migrate_neutron_db.assert_called_with()
258261
262 @patch.object(charmhelpers.contrib.openstack.utils,
263 'get_os_codename_install_source')
264 @patch.object(nutils, 'migrate_neutron_database')
265 @patch.object(nutils, 'stamp_neutron_database')
266 @patch.object(nutils, 'git_install_requested')
267 def test_do_openstack_upgrade_kilo_notleader(self, git_requested,
268 stamp_neutron_db,
269 migrate_neutron_db,
270 gsrc):
271 git_requested.return_value = False
272 self.is_elected_leader.return_value = False
273 self.os_release.return_value = 'juno'
274 self.config.side_effect = self.test_config.get
275 self.test_config.set('openstack-origin', 'cloud:trusty-kilo')
276 gsrc.return_value = 'kilo'
277 self.get_os_codename_install_source.return_value = 'kilo'
278 configs = MagicMock()
279 nutils.do_openstack_upgrade(configs)
280 self.os_release.assert_called_with('neutron-server')
281 self.log.assert_called()
282 self.configure_installation_source.assert_called_with(
283 'cloud:trusty-kilo'
284 )
285 self.apt_update.assert_called_with(fatal=True)
286 dpkg_opts = [
287 '--option', 'Dpkg::Options::=--force-confnew',
288 '--option', 'Dpkg::Options::=--force-confdef',
289 ]
290 self.apt_upgrade.assert_called_with(options=dpkg_opts,
291 fatal=True,
292 dist=True)
293 pkgs = nutils.determine_packages()
294 pkgs.sort()
295 self.apt_install.assert_called_with(packages=pkgs,
296 options=dpkg_opts,
297 fatal=True)
298 configs.set_release.assert_called_with(openstack_release='kilo')
299 self.assertFalse(stamp_neutron_db.called)
300 self.assertFalse(migrate_neutron_db.called)
301
259 @patch.object(ncontext, 'IdentityServiceContext')302 @patch.object(ncontext, 'IdentityServiceContext')
260 @patch('neutronclient.v2_0.client.Client')303 @patch('neutronclient.v2_0.client.Client')
261 def test_get_neutron_client(self, nclient, IdentityServiceContext):304 def test_get_neutron_client(self, nclient, IdentityServiceContext):

Subscribers

People subscribed via source and target branches