peer interface: filter None values
If a remote unit has not provided a value for a given key don't append to the values list - this results in Python None being added to the list which causes issues in consuming templates and code. Change-Id: If5985105714566cddf5bba9fe639097b1c44c1dc
This commit is contained in:
parent
e3b2d05882
commit
b6a52354c5
@ -131,7 +131,9 @@ class OperatorPeers(Object):
|
|||||||
if not self.peers_rel:
|
if not self.peers_rel:
|
||||||
return values
|
return values
|
||||||
for unit in self.peers_rel.units:
|
for unit in self.peers_rel.units:
|
||||||
values.append(self.peers_rel.data[unit].get(key))
|
value = self.peers_rel.data[unit].get(key)
|
||||||
|
if value is not None:
|
||||||
|
values.append(value)
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def set_unit_data(self, settings: Dict[str, str]) -> None:
|
def set_unit_data(self, settings: Dict[str, str]) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user