Merge lp:~gnuoy/charms/trusty/nova-compute/1515570 into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Liam Young
Status: Merged
Merged at revision: 190
Proposed branch: lp:~gnuoy/charms/trusty/nova-compute/1515570
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 75 lines (+37/-4)
2 files modified
hooks/nova_compute_hooks.py (+10/-3)
unit_tests/test_nova_compute_hooks.py (+27/-1)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/nova-compute/1515570
Reviewer Review Type Date Requested Status
James Page Approve
Matt Dupre (community) Approve
Review via email: mp+277556@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Matt Dupre (matthew-dupre) wrote :

Code change looks good to me.

Ashley tested this along with the associated change to our charm to make use of the new setting, and it worked. Would be great to get this merged in.

Thanks,
Matt

review: Approve
Revision history for this message
Matt Dupre (matthew-dupre) wrote :

Liam - just chasing up on this one. Is there anything I can do to get this merged in?

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

charm_lint_check #17336 nova-compute-next for gnuoy mp277556
    LINT OK: passed

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

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

charm_unit_test #16196 nova-compute-next for gnuoy mp277556
    UNIT OK: passed

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

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

charm_amulet_test #8793 nova-compute-next for gnuoy mp277556
    AMULET OK: passed

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

Revision history for this message
James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/nova_compute_hooks.py'
--- hooks/nova_compute_hooks.py 2015-10-14 14:17:49 +0000
+++ hooks/nova_compute_hooks.py 2015-11-16 11:54:16 +0000
@@ -19,7 +19,9 @@
19 restart_on_change,19 restart_on_change,
20 service_restart,20 service_restart,
21)21)
2222from charmhelpers.core.strutils import (
23 bool_from_string,
24)
23from charmhelpers.fetch import (25from charmhelpers.fetch import (
24 apt_install,26 apt_install,
25 apt_purge,27 apt_purge,
@@ -384,9 +386,14 @@
384@restart_on_change(restart_map())386@restart_on_change(restart_map())
385def neutron_plugin_changed():387def neutron_plugin_changed():
386 settings = relation_get()388 settings = relation_get()
387 if 'metadata-shared-secret' in settings:389 if settings.get('enable-metadata'):
390 enable_metadata = bool_from_string(settings['enable-metadata'])
391 else:
392 enable_metadata = False
393 if 'metadata-shared-secret' in settings or enable_metadata:
388 apt_update()394 apt_update()
389 apt_install('nova-api-metadata', fatal=True)395 apt_install(filter_installed_packages(['nova-api-metadata']),
396 fatal=True)
390 else:397 else:
391 apt_purge('nova-api-metadata', fatal=True)398 apt_purge('nova-api-metadata', fatal=True)
392 CONFIGS.write(NOVA_CONF)399 CONFIGS.write(NOVA_CONF)
393400
=== modified file 'unit_tests/test_nova_compute_hooks.py'
--- unit_tests/test_nova_compute_hooks.py 2015-10-06 16:58:22 +0000
+++ unit_tests/test_nova_compute_hooks.py 2015-11-16 11:54:16 +0000
@@ -25,6 +25,7 @@
25 'unit_get',25 'unit_get',
26 # charmhelpers.core.host26 # charmhelpers.core.host
27 'apt_install',27 'apt_install',
28 'apt_purge',
28 'apt_update',29 'apt_update',
29 'filter_installed_packages',30 'filter_installed_packages',
30 'restart_on_change',31 'restart_on_change',
@@ -484,5 +485,30 @@
484 'sharedsecret'}485 'sharedsecret'}
485 hooks.neutron_plugin_changed()486 hooks.neutron_plugin_changed()
486 self.assertTrue(self.apt_update.called)487 self.assertTrue(self.apt_update.called)
487 self.apt_install.assert_called_with('nova-api-metadata', fatal=True)488 self.apt_install.assert_called_with(['nova-api-metadata'],
489 fatal=True)
490 configs.write.assert_called_with('/etc/nova/nova.conf')
491
492 @patch.object(hooks, 'CONFIGS')
493 def test_neutron_plugin_changed_nometa_implicit(self, configs):
494 self.relation_get.return_value = {}
495 hooks.neutron_plugin_changed()
496 self.apt_purge.assert_called_with('nova-api-metadata',
497 fatal=True)
498 configs.write.assert_called_with('/etc/nova/nova.conf')
499
500 @patch.object(hooks, 'CONFIGS')
501 def test_neutron_plugin_changed_meta(self, configs):
502 self.relation_get.return_value = {'enable-metadata': 'True'}
503 hooks.neutron_plugin_changed()
504 self.apt_install.assert_called_with(['nova-api-metadata'],
505 fatal=True)
506 configs.write.assert_called_with('/etc/nova/nova.conf')
507
508 @patch.object(hooks, 'CONFIGS')
509 def test_neutron_plugin_changed_nometa_explicit(self, configs):
510 self.relation_get.return_value = {'enable-metadata': 'false'}
511 hooks.neutron_plugin_changed()
512 self.apt_purge.assert_called_with('nova-api-metadata',
513 fatal=True)
488 configs.write.assert_called_with('/etc/nova/nova.conf')514 configs.write.assert_called_with('/etc/nova/nova.conf')

Subscribers

People subscribed via source and target branches