Merge lp:~billy-olsen/charms/trusty/ceilometer/lp1541618 into lp:~openstack-charmers-archive/charms/trusty/ceilometer/next

Proposed by Billy Olsen on 2016-02-04
Status: Merged
Merged at revision: 114
Proposed branch: lp:~billy-olsen/charms/trusty/ceilometer/lp1541618
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceilometer/next
Diff against target: 71 lines (+9/-6)
2 files modified
hooks/ceilometer_hooks.py (+5/-2)
unit_tests/test_ceilometer_hooks.py (+4/-4)
To merge this branch: bzr merge lp:~billy-olsen/charms/trusty/ceilometer/lp1541618
Reviewer Review Type Date Requested Status
James Page 2016-02-04 Approve on 2016-02-04
Review via email: mp+285003@code.launchpad.net
To post a comment you must log in.
James Page (james-page) wrote :

+1 conditional on OSCI +1 as well; but looks sane to me!

review: Approve

charm_lint_check #126 ceilometer-next for billy-olsen mp285003
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/126/

charm_unit_test #126 ceilometer-next for billy-olsen mp285003
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/126/

charm_amulet_test #20 ceilometer-next for billy-olsen mp285003
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/20/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/ceilometer_hooks.py'
2--- hooks/ceilometer_hooks.py 2015-10-16 11:59:37 +0000
3+++ hooks/ceilometer_hooks.py 2016-02-04 01:23:23 +0000
4@@ -57,7 +57,10 @@
5 get_hacluster_config,
6 is_elected_leader
7 )
8-from charmhelpers.contrib.peerstorage import peer_store
9+from charmhelpers.contrib.peerstorage import (
10+ peer_retrieve,
11+ peer_store,
12+)
13 from charmhelpers.payload.execd import execd_preinstall
14
15 hooks = Hooks()
16@@ -185,7 +188,7 @@
17 'cluster-relation-departed')
18 @restart_on_change(restart_map(), stopstart=True)
19 def cluster_changed():
20- shared_secret = relation_get('shared_secret')
21+ shared_secret = peer_retrieve('shared_secret')
22 if shared_secret is None or shared_secret.strip() == '':
23 log('waiting for shared secret to be provided by leader')
24 elif not shared_secret == get_shared_secret():
25
26=== modified file 'unit_tests/test_ceilometer_hooks.py'
27--- unit_tests/test_ceilometer_hooks.py 2016-01-06 21:38:19 +0000
28+++ unit_tests/test_ceilometer_hooks.py 2016-02-04 01:23:23 +0000
29@@ -16,7 +16,6 @@
30 TO_PATCH = [
31 'relation_get',
32 'relation_set',
33- 'relation_get',
34 'configure_installation_source',
35 'openstack_upgrade_available',
36 'do_openstack_upgrade',
37@@ -33,6 +32,7 @@
38 'get_packages',
39 'service_restart',
40 'update_nrpe_config',
41+ 'peer_retrieve',
42 'peer_store',
43 'configure_https',
44 'status_set',
45@@ -234,7 +234,7 @@
46 @patch('charmhelpers.core.hookenv.config')
47 @patch.object(hooks, 'set_shared_secret')
48 def test_cluster_changed(self, shared_secret, mock_config):
49- self.relation_get.return_value = None
50+ self.peer_retrieve.return_value = None
51 hooks.hooks.execute(['hooks/cluster-relation-changed'])
52 self.assertFalse(shared_secret.called)
53
54@@ -243,7 +243,7 @@
55 @patch.object(hooks, 'set_shared_secret')
56 def test_cluster_changed_new_secret(self, mock_set_secret, mock_get_secret,
57 mock_config):
58- self.relation_get.return_value = "leader_secret"
59+ self.peer_retrieve.return_value = "leader_secret"
60 mock_get_secret.return_value = "my_secret"
61 hooks.hooks.execute(['hooks/cluster-relation-changed'])
62 mock_set_secret.assert_called_with("leader_secret")
63@@ -253,7 +253,7 @@
64 @patch.object(hooks, 'set_shared_secret')
65 def test_cluster_changed_old_secret(self, mock_set_secret, mock_get_secret,
66 mock_config):
67- self.relation_get.return_value = "leader_secret"
68+ self.peer_retrieve.return_value = "leader_secret"
69 mock_get_secret.return_value = "leader_secret"
70 hooks.hooks.execute(['hooks/cluster-relation-changed'])
71 self.assertEquals(mock_set_secret.call_count, 0)

Subscribers

People subscribed via source and target branches