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
1=== modified file 'hooks/nova_compute_hooks.py'
2--- hooks/nova_compute_hooks.py 2015-10-14 14:17:49 +0000
3+++ hooks/nova_compute_hooks.py 2015-11-16 11:54:16 +0000
4@@ -19,7 +19,9 @@
5 restart_on_change,
6 service_restart,
7 )
8-
9+from charmhelpers.core.strutils import (
10+ bool_from_string,
11+)
12 from charmhelpers.fetch import (
13 apt_install,
14 apt_purge,
15@@ -384,9 +386,14 @@
16 @restart_on_change(restart_map())
17 def neutron_plugin_changed():
18 settings = relation_get()
19- if 'metadata-shared-secret' in settings:
20+ if settings.get('enable-metadata'):
21+ enable_metadata = bool_from_string(settings['enable-metadata'])
22+ else:
23+ enable_metadata = False
24+ if 'metadata-shared-secret' in settings or enable_metadata:
25 apt_update()
26- apt_install('nova-api-metadata', fatal=True)
27+ apt_install(filter_installed_packages(['nova-api-metadata']),
28+ fatal=True)
29 else:
30 apt_purge('nova-api-metadata', fatal=True)
31 CONFIGS.write(NOVA_CONF)
32
33=== modified file 'unit_tests/test_nova_compute_hooks.py'
34--- unit_tests/test_nova_compute_hooks.py 2015-10-06 16:58:22 +0000
35+++ unit_tests/test_nova_compute_hooks.py 2015-11-16 11:54:16 +0000
36@@ -25,6 +25,7 @@
37 'unit_get',
38 # charmhelpers.core.host
39 'apt_install',
40+ 'apt_purge',
41 'apt_update',
42 'filter_installed_packages',
43 'restart_on_change',
44@@ -484,5 +485,30 @@
45 'sharedsecret'}
46 hooks.neutron_plugin_changed()
47 self.assertTrue(self.apt_update.called)
48- self.apt_install.assert_called_with('nova-api-metadata', fatal=True)
49+ self.apt_install.assert_called_with(['nova-api-metadata'],
50+ fatal=True)
51+ configs.write.assert_called_with('/etc/nova/nova.conf')
52+
53+ @patch.object(hooks, 'CONFIGS')
54+ def test_neutron_plugin_changed_nometa_implicit(self, configs):
55+ self.relation_get.return_value = {}
56+ hooks.neutron_plugin_changed()
57+ self.apt_purge.assert_called_with('nova-api-metadata',
58+ fatal=True)
59+ configs.write.assert_called_with('/etc/nova/nova.conf')
60+
61+ @patch.object(hooks, 'CONFIGS')
62+ def test_neutron_plugin_changed_meta(self, configs):
63+ self.relation_get.return_value = {'enable-metadata': 'True'}
64+ hooks.neutron_plugin_changed()
65+ self.apt_install.assert_called_with(['nova-api-metadata'],
66+ fatal=True)
67+ configs.write.assert_called_with('/etc/nova/nova.conf')
68+
69+ @patch.object(hooks, 'CONFIGS')
70+ def test_neutron_plugin_changed_nometa_explicit(self, configs):
71+ self.relation_get.return_value = {'enable-metadata': 'false'}
72+ hooks.neutron_plugin_changed()
73+ self.apt_purge.assert_called_with('nova-api-metadata',
74+ fatal=True)
75 configs.write.assert_called_with('/etc/nova/nova.conf')

Subscribers

People subscribed via source and target branches