Always process node addresses

Never return a node without an address, otherwise the call to CLB
will fail.

Change-Id: I443b568f509246f8d38a8ddcf0ce4b1d1fd0c689
This commit is contained in:
Randall Burt 2015-11-04 12:25:36 -06:00 committed by Jason Dunsmore
parent 2fd7367475
commit 693e8605fb
2 changed files with 7 additions and 9 deletions

View File

@ -503,10 +503,7 @@ class CloudLoadBalancer(resource.Resource):
return False return False
def _process_node(self, node): def _process_node(self, node):
if not node.get(self.NODE_ADDRESSES): for addr in node.get(self.NODE_ADDRESSES, []):
yield node
else:
for addr in node.get(self.NODE_ADDRESSES):
norm_node = copy.deepcopy(node) norm_node = copy.deepcopy(node)
norm_node['address'] = addr norm_node['address'] = addr
del norm_node[self.NODE_ADDRESSES] del norm_node[self.NODE_ADDRESSES]

View File

@ -424,7 +424,8 @@ class LoadBalancerTest(common.HeatTestCase):
def test_process_node(self): def test_process_node(self):
nodes = [{'addresses': ['1234'], 'port': 80, 'enabled': True}, nodes = [{'addresses': ['1234'], 'port': 80, 'enabled': True},
{'addresses': ['4567', '8901', '8903'], 'port': 80, {'addresses': ['4567', '8901', '8903'], 'port': 80,
'enabled': True}] 'enabled': True},
{'addresses': [], 'port': 80, 'enabled': True}]
rsrc, fake_lb = self._mock_loadbalancer(self.lb_template, rsrc, fake_lb = self._mock_loadbalancer(self.lb_template,
self.lb_name, self.lb_name,
self.expected_body) self.expected_body)