Merge lp:~gnuoy/charm-helpers/memcache-trusty into lp:charm-helpers

Proposed by Liam Young
Status: Merged
Merged at revision: 666
Proposed branch: lp:~gnuoy/charm-helpers/memcache-trusty
Merge into: lp:charm-helpers
Diff against target: 44 lines (+11/-2)
2 files modified
charmhelpers/contrib/openstack/context.py (+6/-2)
tests/contrib/openstack/test_os_contexts.py (+5/-0)
To merge this branch: bzr merge lp:~gnuoy/charm-helpers/memcache-trusty
Reviewer Review Type Date Requested Status
David Ames (community) Approve
Review via email: mp+312931@code.launchpad.net
To post a comment you must log in.
667. By Liam Young

Fix copy/pasta error

Revision history for this message
David Ames (thedac) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charmhelpers/contrib/openstack/context.py'
--- charmhelpers/contrib/openstack/context.py 2016-11-29 16:01:56 +0000
+++ charmhelpers/contrib/openstack/context.py 2016-12-09 16:59:45 +0000
@@ -1525,11 +1525,15 @@
1525 ctxt = {}1525 ctxt = {}
1526 ctxt['use_memcache'] = enable_memcache(config('openstack-origin'))1526 ctxt['use_memcache'] = enable_memcache(config('openstack-origin'))
1527 if ctxt['use_memcache']:1527 if ctxt['use_memcache']:
1528 ctxt['memcache_server'] = '::1'1528 # Trusty version of memcached does not support ::1 as a listen
1529 # address so use host file entry instead
1530 if lsb_release()['DISTRIB_CODENAME'].lower() > 'trusty':
1531 ctxt['memcache_server'] = '::1'
1532 else:
1533 ctxt['memcache_server'] = 'ip6-localhost'
1529 ctxt['memcache_server_formatted'] = '[::1]'1534 ctxt['memcache_server_formatted'] = '[::1]'
1530 ctxt['memcache_port'] = '11211'1535 ctxt['memcache_port'] = '11211'
1531 ctxt['memcache_url'] = 'inet6:{}:{}'.format(1536 ctxt['memcache_url'] = 'inet6:{}:{}'.format(
1532 ctxt['memcache_server_formatted'],1537 ctxt['memcache_server_formatted'],
1533 ctxt['memcache_port'])1538 ctxt['memcache_port'])
1534
1535 return ctxt1539 return ctxt
15361540
=== modified file 'tests/contrib/openstack/test_os_contexts.py'
--- tests/contrib/openstack/test_os_contexts.py 2016-11-29 16:01:56 +0000
+++ tests/contrib/openstack/test_os_contexts.py 2016-12-09 16:59:45 +0000
@@ -3005,6 +3005,7 @@
30053005
3006 @patch.object(context, 'enable_memcache')3006 @patch.object(context, 'enable_memcache')
3007 def test_memcache_context(self, _enable_memcache):3007 def test_memcache_context(self, _enable_memcache):
3008 self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
3008 _enable_memcache.return_value = True3009 _enable_memcache.return_value = True
3009 config = {'openstack-origin': 'distro'}3010 config = {'openstack-origin': 'distro'}
3010 self.config.side_effect = fake_config(config)3011 self.config.side_effect = fake_config(config)
@@ -3017,6 +3018,10 @@
3017 'memcache_url': 'inet6:[::1]:11211',3018 'memcache_url': 'inet6:[::1]:11211',
3018 'use_memcache': True}3019 'use_memcache': True}
3019 self.assertEqual(ctxt(), expect)3020 self.assertEqual(ctxt(), expect)
3021 self.lsb_release.return_value = {'DISTRIB_CODENAME': 'trusty'}
3022 expect['memcache_server'] = 'ip6-localhost'
3023 ctxt = context.MemcacheContext()
3024 self.assertEqual(ctxt(), expect)
30203025
3021 @patch.object(context, 'enable_memcache')3026 @patch.object(context, 'enable_memcache')
3022 def test_memcache_off_context(self, _enable_memcache):3027 def test_memcache_off_context(self, _enable_memcache):

Subscribers

People subscribed via source and target branches