Merge lp:~hopem/charms/trusty/nova-compute/lp1499656 into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 162
Proposed branch: lp:~hopem/charms/trusty/nova-compute/lp1499656
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 46 lines (+13/-4)
2 files modified
hooks/nova_compute_context.py (+2/-2)
unit_tests/test_nova_compute_contexts.py (+11/-2)
To merge this branch: bzr merge lp:~hopem/charms/trusty/nova-compute/lp1499656
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+272636@code.launchpad.net
To post a comment you must log in.
163. By Edward Hope-Morley

add u/t

Revision history for this message
Billy Olsen (billy-olsen) wrote :

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_compute_context.py'
2--- hooks/nova_compute_context.py 2015-09-28 07:56:16 +0000
3+++ hooks/nova_compute_context.py 2015-09-28 17:33:10 +0000
4@@ -26,7 +26,6 @@
5 from charmhelpers.contrib.network.ip import (
6 get_address_in_network,
7 get_ipv6_addr,
8- format_ipv6_addr,
9 )
10
11 # This is just a label and it must be consistent across
12@@ -493,6 +492,7 @@
13 host_ip = get_host_ip(unit_get('private-address'))
14
15 if host_ip:
16- ctxt['host_ip'] = format_ipv6_addr(host_ip) or host_ip
17+ # NOTE: do not format this even for ipv6 (see bug 1499656)
18+ ctxt['host_ip'] = host_ip
19
20 return ctxt
21
22=== modified file 'unit_tests/test_nova_compute_contexts.py'
23--- unit_tests/test_nova_compute_contexts.py 2015-03-31 08:46:52 +0000
24+++ unit_tests/test_nova_compute_contexts.py 2015-09-28 17:33:10 +0000
25@@ -230,10 +230,19 @@
26 self.log = fake_log
27 self.unit_get.return_value = '172.24.0.79'
28 host_ip = context.HostIPContext()
29- self.assertEquals(
30- {'host_ip': '172.24.0.79'}, host_ip())
31+ self.assertEquals({'host_ip': '172.24.0.79'}, host_ip())
32 self.unit_get.assert_called_with('private-address')
33
34+ @patch.object(context, 'get_ipv6_addr')
35+ @patch('subprocess.call')
36+ def test_host_IP_context_ipv6(self, _call, mock_get_ipv6_addr):
37+ self.log = fake_log
38+ self.test_config.set('prefer-ipv6', True)
39+ mock_get_ipv6_addr.return_value = ['2001:db8:0:1::2']
40+ host_ip = context.HostIPContext()
41+ self.assertEquals({'host_ip': '2001:db8:0:1::2'}, host_ip())
42+ self.assertTrue(mock_get_ipv6_addr.called)
43+
44 def test_metadata_service_ctxt(self):
45 self.relation_ids.return_value = 'neutron-plugin:0'
46 self.related_units.return_value = 'neutron-openvswitch/0'

Subscribers

People subscribed via source and target branches