C-H Sync to bring in trusty memcache fix

Memcache was failing to start on trusty with Invalid Port when
::1 was specified. This C-H Sync will fix the issue.

Change-Id: Ieb3770f3aada33c2689898421e1af04202a30293
This commit is contained in:
David Ames 2016-12-09 10:20:34 -08:00
parent 8ec8b6a706
commit 9fca38a558
4 changed files with 20 additions and 5 deletions

View File

@ -1177,9 +1177,14 @@ class OpenStackAmuletUtils(AmuletUtils):
'/etc/memcached.conf')
contents = self.file_contents_safe(sentry_unit, '/etc/memcached.conf',
fatal=True)
ubuntu_release, _ = self.run_cmd_unit(sentry_unit, 'lsb_release -cs')
if ubuntu_release <= 'trusty':
memcache_listen_addr = 'ip6-localhost'
else:
memcache_listen_addr = '::1'
expected = {
'-p': '11211',
'-l': '::1'}
'-l': memcache_listen_addr}
found = []
for key, value in expected.items():
for line in contents.split('\n'):

View File

@ -1525,11 +1525,15 @@ class MemcacheContext(OSContextGenerator):
ctxt = {}
ctxt['use_memcache'] = enable_memcache(config('openstack-origin'))
if ctxt['use_memcache']:
ctxt['memcache_server'] = '::1'
# Trusty version of memcached does not support ::1 as a listen
# address so use host file entry instead
if lsb_release()['DISTRIB_CODENAME'].lower() > 'trusty':
ctxt['memcache_server'] = '::1'
else:
ctxt['memcache_server'] = 'ip6-localhost'
ctxt['memcache_server_formatted'] = '[::1]'
ctxt['memcache_port'] = '11211'
ctxt['memcache_url'] = 'inet6:{}:{}'.format(
ctxt['memcache_server_formatted'],
ctxt['memcache_port'])
return ctxt

View File

@ -148,7 +148,8 @@ class AmuletUtils(object):
for service_name in services_list:
if (self.ubuntu_releases.index(release) >= systemd_switch or
service_name in ['rabbitmq-server', 'apache2']):
service_name in ['rabbitmq-server', 'apache2',
'memcached']):
# init is systemd (or regular sysv)
cmd = 'sudo service {} status'.format(service_name)
output, code = sentry_unit.run(cmd)

View File

@ -1177,9 +1177,14 @@ class OpenStackAmuletUtils(AmuletUtils):
'/etc/memcached.conf')
contents = self.file_contents_safe(sentry_unit, '/etc/memcached.conf',
fatal=True)
ubuntu_release, _ = self.run_cmd_unit(sentry_unit, 'lsb_release -cs')
if ubuntu_release <= 'trusty':
memcache_listen_addr = 'ip6-localhost'
else:
memcache_listen_addr = '::1'
expected = {
'-p': '11211',
'-l': '::1'}
'-l': memcache_listen_addr}
found = []
for key, value in expected.items():
for line in contents.split('\n'):