[hopem,r=]

Ensure apache2 reloaded/restarted when https configured

Closes-Bug: #1410568
This commit is contained in:
Edward Hope-Morley 2015-03-29 21:09:09 +01:00
parent aba3ba567a
commit b0c4945ca6
2 changed files with 18 additions and 5 deletions

@ -3,7 +3,11 @@ import os
import sys
import uuid
from subprocess import check_call
from subprocess import (
call,
check_call,
CalledProcessError,
)
from cinder_utils import (
determine_packages,
@ -432,6 +436,13 @@ def configure_https():
cmd = ['a2dissite', 'openstack_https_frontend']
check_call(cmd)
# TODO: improve this by checking if local CN certs are available
# first then checking reload status (see LP #1433114).
try:
check_call(['service', 'apache2', 'reload'])
except CalledProcessError:
call(['service', 'apache2', 'restart'])
for rid in relation_ids('identity-service'):
identity_joined(rid=rid)

@ -233,8 +233,9 @@ class TestChangedHooks(CharmTestCase):
self.CONFIGS.complete_contexts.return_value = ['https']
self.relation_ids.return_value = ['identity-service:0']
hooks.configure_https()
cmd = ['a2ensite', 'openstack_https_frontend']
self.check_call.assert_called_with(cmd)
calls = [call('a2dissite', 'openstack_https_frontend'),
call('service', 'apache2', 'reload')]
self.check_call.assert_called_has_calls(calls)
identity_joined.assert_called_with(rid='identity-service:0')
@patch.object(hooks, 'identity_joined')
@ -243,8 +244,9 @@ class TestChangedHooks(CharmTestCase):
self.CONFIGS.complete_contexts.return_value = []
self.relation_ids.return_value = ['identity-service:0']
hooks.configure_https()
cmd = ['a2dissite', 'openstack_https_frontend']
self.check_call.assert_called_with(cmd)
calls = [call('a2dissite', 'openstack_https_frontend'),
call('service', 'apache2', 'reload')]
self.check_call.assert_called_has_calls(calls)
identity_joined.assert_called_with(rid='identity-service:0')
def test_image_service_changed(self):