Make peer discover more defensive
Before adding a (unit-name, address) tuple to the list of peers for a particular address type, ensure that the unit has actually presented data for the requested address type. This avoids 'None' values being written to the haproxy configuration files during initial deployment and scale back of units. Change-Id: Ia10e1454791d92b9ca6233425b4a6ea89642def0 Closes-Bug: 1849901
This commit is contained in:
4
peers.py
4
peers.py
@@ -35,7 +35,9 @@ class OpenstackHAPeers(RelationBase):
|
||||
nodes = []
|
||||
for conv in self.conversations():
|
||||
host_name = conv.scope.replace('/', '-')
|
||||
nodes.append((host_name, conv.get_remote(address_key)))
|
||||
address = conv.get_remote(address_key)
|
||||
if address:
|
||||
nodes.append((host_name, address))
|
||||
|
||||
return nodes
|
||||
|
||||
|
Reference in New Issue
Block a user