Ensure memcached service is restarted with apache2

Upgrade testing of openstack-dashboard was unsuccessful due
to memcached not being restarted.

Change-Id: Ib46f5dd3594184cbc3433c84e583d5ca35532330
This commit is contained in:
Corey Bryant 2017-01-31 12:51:51 +00:00
parent 8c9e46863b
commit 6f34e1e8c7
4 changed files with 35 additions and 22 deletions

View File

@ -130,39 +130,39 @@ CONFIG_FILES = OrderedDict([
horizon_contexts.IdentityServiceContext(),
context.SyslogContext(),
horizon_contexts.LocalSettingsContext()],
'services': ['apache2']
'services': ['apache2', 'memcached']
}),
(APACHE_CONF, {
'hook_contexts': [horizon_contexts.HorizonContext(),
context.SyslogContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(APACHE_24_CONF, {
'hook_contexts': [horizon_contexts.HorizonContext(),
context.SyslogContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(APACHE_SSL, {
'hook_contexts': [horizon_contexts.ApacheSSLContext(),
horizon_contexts.ApacheContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(APACHE_24_SSL, {
'hook_contexts': [horizon_contexts.ApacheSSLContext(),
horizon_contexts.ApacheContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(APACHE_DEFAULT, {
'hook_contexts': [horizon_contexts.ApacheContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(APACHE_24_DEFAULT, {
'hook_contexts': [horizon_contexts.ApacheContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(PORTS_CONF, {
'hook_contexts': [horizon_contexts.ApacheContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(HAPROXY_CONF, {
'hook_contexts': [
@ -173,11 +173,11 @@ CONFIG_FILES = OrderedDict([
}),
(ROUTER_SETTING, {
'hook_contexts': [horizon_contexts.RouterSettingContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
(KEYSTONEV3_POLICY, {
'hook_contexts': [horizon_contexts.IdentityServiceContext()],
'services': ['apache2'],
'services': ['apache2', 'memcached'],
}),
])

View File

@ -276,7 +276,8 @@ class OpenstackDashboardBasicDeployment(OpenStackAmuletDeployment):
# Services which are expected to restart upon config change,
# and corresponding config files affected by the change
services = {'apache2': '/etc/openstack-dashboard/local_settings.py'}
services = {'apache2': '/etc/openstack-dashboard/local_settings.py',
'memcached': '/etc/openstack-dashboard/local_settings.py'}
# Make config change, check for service restarts
u.log.debug('Making config change on {}...'.format(juju_service))

View File

@ -189,8 +189,10 @@ class TestHorizonHooks(CharmTestCase):
self.assertTrue(self.CONFIGS.write_all.called)
ex = [
call('stop', 'apache2'),
call('stop', 'memcached'),
call('stop', 'haproxy'),
call('start', 'apache2'),
call('start', 'memcached'),
call('start', 'haproxy'),
]
self.assertEquals(ex, _service.call_args_list)

View File

@ -83,20 +83,30 @@ class TestHorizohorizon_utils(CharmTestCase):
def test_restart_map(self):
ex_map = OrderedDict([
('/etc/openstack-dashboard/local_settings.py', ['apache2']),
('/etc/apache2/conf.d/openstack-dashboard.conf', ['apache2']),
('/etc/openstack-dashboard/local_settings.py',
['apache2', 'memcached']),
('/etc/apache2/conf.d/openstack-dashboard.conf',
['apache2', 'memcached']),
('/etc/apache2/conf-available/openstack-dashboard.conf',
['apache2']),
('/etc/apache2/sites-available/default-ssl', ['apache2']),
('/etc/apache2/sites-available/default-ssl.conf', ['apache2']),
('/etc/apache2/sites-available/default', ['apache2']),
('/etc/apache2/sites-available/000-default.conf', ['apache2']),
('/etc/apache2/ports.conf', ['apache2']),
('/etc/haproxy/haproxy.cfg', ['haproxy']),
['apache2', 'memcached']),
('/etc/apache2/sites-available/default-ssl',
['apache2', 'memcached']),
('/etc/apache2/sites-available/default-ssl.conf',
['apache2', 'memcached']),
('/etc/apache2/sites-available/default',
['apache2', 'memcached']),
('/etc/apache2/sites-available/000-default.conf',
['apache2', 'memcached']),
('/etc/apache2/ports.conf',
['apache2', 'memcached']),
('/etc/haproxy/haproxy.cfg',
['haproxy']),
('/usr/share/openstack-dashboard/openstack_dashboard/enabled/'
'_40_router.py', ['apache2']),
'_40_router.py',
['apache2', 'memcached']),
('/usr/share/openstack-dashboard/openstack_dashboard/conf/'
'keystonev3_policy.json', ['apache2']),
'keystonev3_policy.json',
['apache2', 'memcached']),
])
self.assertEquals(horizon_utils.restart_map(), ex_map)