Restore use of addresses on ovsdb-cms interface

Not all clients can use hostnames so present IP address information
as well so clients can pick and choose depending on capability.

Depends-On: Iefe8ad601b305e3fdab7548e1d3357493491d3e9
Change-Id: Ia2cf78b16694328ed2de236a54e5193b36d9aad5
This commit is contained in:
James Page 2022-10-24 13:11:10 +01:00
parent f0a937f2d8
commit fc1fd10ab0

View File

@ -37,7 +37,7 @@ LIBAPI = 0
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 2
LIBPATCH = 3
# TODO: add your code here! Happy coding!
@ -104,8 +104,11 @@ class OVSDBCMSRequires(Object):
def bound_hostnames(self):
return self.get_all_unit_values("bound-hostname")
def bound_addresses(self):
return self.get_all_unit_values("bound-address")
def remote_ready(self):
return all(self.bound_hostnames())
return all(self.bound_hostnames()) or all(self.bound_addresses())
def _on_ovsdb_cms_relation_changed(self, event):
"""OVSDBCMS relation changed."""
@ -201,5 +204,3 @@ class OVSDBCMSProvides(Object):
for relation in relations:
for k, v in settings.items():
relation.data[self.model.unit][k] = v