Do not use relation_ids directly
Use a for loop to handle relation_ids for the case when the relationship has not yet been created. Change-Id: Ia9cf980591a1bf707f3a1a009229c5f5c222206f Closes-Bug: #1777508
This commit is contained in:
parent
055d2bb17f
commit
1c4d991232
|
@ -905,14 +905,14 @@ def cluster_ready():
|
|||
return seeded()
|
||||
|
||||
peers = {}
|
||||
relation_id = relation_ids('cluster')[0]
|
||||
units = related_units(relation_id) or []
|
||||
if local_unit() not in units:
|
||||
units.append(local_unit())
|
||||
for unit in units:
|
||||
peers[unit] = relation_get(attribute='ready',
|
||||
rid=relation_id,
|
||||
unit=unit)
|
||||
for relation_id in relation_ids('cluster'):
|
||||
units = related_units(relation_id) or []
|
||||
if local_unit() not in units:
|
||||
units.append(local_unit())
|
||||
for unit in units:
|
||||
peers[unit] = relation_get(attribute='ready',
|
||||
rid=relation_id,
|
||||
unit=unit)
|
||||
|
||||
if len(peers) >= min_cluster_size:
|
||||
return all(peers.values())
|
||||
|
|
Loading…
Reference in New Issue