Merge lp:~hopem/charms/trusty/cinder/ensure-apache-restart into lp:~openstack-charmers-archive/charms/trusty/cinder/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 82
Proposed branch: lp:~hopem/charms/trusty/cinder/ensure-apache-restart
Merge into: lp:~openstack-charmers-archive/charms/trusty/cinder/next
Diff against target: 69 lines (+15/-5)
2 files modified
hooks/cinder_hooks.py (+8/-1)
unit_tests/test_cinder_hooks.py (+7/-4)
To merge this branch: bzr merge lp:~hopem/charms/trusty/cinder/ensure-apache-restart
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+254515@code.launchpad.net

This proposal supersedes a proposal from 2015-03-29.

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #2962 cinder-next for hopem mp254515
    LINT OK: passed

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

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

charm_unit_test #2753 cinder-next for hopem mp254515
    UNIT OK: passed

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

82. By Edward Hope-Morley

use service_reload()

Revision history for this message
Billy Olsen (billy-olsen) wrote :

LGTM, Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/cinder_hooks.py'
2--- hooks/cinder_hooks.py 2015-03-24 13:47:40 +0000
3+++ hooks/cinder_hooks.py 2015-03-30 17:26:46 +0000
4@@ -3,7 +3,9 @@
5 import sys
6 import uuid
7
8-from subprocess import check_call
9+from subprocess import (
10+ check_call,
11+)
12
13 from cinder_utils import (
14 determine_packages,
15@@ -47,6 +49,7 @@
16 from charmhelpers.core.host import (
17 lsb_release,
18 restart_on_change,
19+ service_reload,
20 )
21
22 from charmhelpers.contrib.openstack.utils import (
23@@ -460,6 +463,10 @@
24 cmd = ['a2dissite', 'openstack_https_frontend']
25 check_call(cmd)
26
27+ # TODO: improve this by checking if local CN certs are available
28+ # first then checking reload status (see LP #1433114).
29+ service_reload('apache2', restart_on_failure=True)
30+
31 for rid in relation_ids('identity-service'):
32 identity_joined(rid=rid)
33
34
35=== modified file 'unit_tests/test_cinder_hooks.py'
36--- unit_tests/test_cinder_hooks.py 2015-03-25 08:40:21 +0000
37+++ unit_tests/test_cinder_hooks.py 2015-03-30 17:26:46 +0000
38@@ -59,6 +59,7 @@
39 # charmhelpers.core.host
40 'apt_install',
41 'apt_update',
42+ 'service_reload',
43 # charmhelpers.contrib.openstack.openstack_utils
44 'configure_installation_source',
45 'openstack_upgrade_available',
46@@ -234,8 +235,9 @@
47 self.CONFIGS.complete_contexts.return_value = ['https']
48 self.relation_ids.return_value = ['identity-service:0']
49 hooks.configure_https()
50- cmd = ['a2ensite', 'openstack_https_frontend']
51- self.check_call.assert_called_with(cmd)
52+ calls = [call('a2dissite', 'openstack_https_frontend'),
53+ call('service', 'apache2', 'reload')]
54+ self.check_call.assert_called_has_calls(calls)
55 identity_joined.assert_called_with(rid='identity-service:0')
56
57 @patch.object(hooks, 'identity_joined')
58@@ -244,8 +246,9 @@
59 self.CONFIGS.complete_contexts.return_value = []
60 self.relation_ids.return_value = ['identity-service:0']
61 hooks.configure_https()
62- cmd = ['a2dissite', 'openstack_https_frontend']
63- self.check_call.assert_called_with(cmd)
64+ calls = [call('a2dissite', 'openstack_https_frontend'),
65+ call('service', 'apache2', 'reload')]
66+ self.check_call.assert_called_has_calls(calls)
67 identity_joined.assert_called_with(rid='identity-service:0')
68
69 def test_image_service_changed(self):

Subscribers

People subscribed via source and target branches