diff --git a/hooks/keystone_utils.py b/hooks/keystone_utils.py index b37a85e4..24c5eb78 100644 --- a/hooks/keystone_utils.py +++ b/hooks/keystone_utils.py @@ -626,9 +626,12 @@ def register_configs(): def restart_map(): - return OrderedDict([(cfg, v['services']) - for cfg, v in resource_map().items() - if v['services']]) + restart_map = OrderedDict([(cfg, v['services']) + for cfg, v in resource_map().items() + if v['services']]) + if os.path.isdir(APACHE_SSL_DIR): + restart_map['{}/*'.format(APACHE_SSL_DIR)] = ['apache2'] + return restart_map def services(): diff --git a/unit_tests/test_keystone_utils.py b/unit_tests/test_keystone_utils.py index 01bd7dce..33eba9a6 100644 --- a/unit_tests/test_keystone_utils.py +++ b/unit_tests/test_keystone_utils.py @@ -1511,3 +1511,23 @@ class TestKeystoneUtils(CharmTestCase): 'cluster': {'interface': 'openstack-ha'}}} metadata.return_value = _metadata self.assertEqual(utils.container_scoped_relations(), ['ha']) + + @patch.object(utils, 'resource_map') + @patch.object(utils.os.path, 'isdir') + def test_restart_map(self, osp_isdir, resource_map): + rsc_map = collections.OrderedDict([ + ('file1', { + 'services': ['svc1'], + 'contexts': ['ctxt1']})]) + resource_map.return_value = rsc_map + osp_isdir.return_value = False + self.assertEqual( + utils.restart_map(), + collections.OrderedDict([ + ('file1', ['svc1'])])) + osp_isdir.return_value = True + self.assertEqual( + utils.restart_map(), + collections.OrderedDict([ + ('file1', ['svc1']), + ('/etc/apache2/ssl/keystone/*', ['apache2'])]))