Override db_*_connection_strs property for peer relation
When on the peer relation the list of remote addresses does not contain self. The db_*_connection_strs properties are used for clients run on the central units and they need to talk to all peers. Deal with the difference in the interface so usage is unform in consuming charms regardsless of relation type. Change-Id: I86b530db330d59c7e31d75b05aeaa99415b59324
This commit is contained in:
parent
f418ef90db
commit
ee8965c489
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import itertools
|
||||
|
||||
import charmhelpers.core as ch_core
|
||||
|
||||
import charms.reactive as reactive
|
||||
@ -48,6 +50,38 @@ class OVSDBClusterPeer(ovsdb.OVSDB):
|
||||
return True
|
||||
return False
|
||||
|
||||
@property
|
||||
def db_nb_connection_strs(self):
|
||||
"""Return list of Northbound DB connection strings.
|
||||
|
||||
We override the parent property because for the peer relation
|
||||
``cluster_remote_addrs`` does not contain self.
|
||||
|
||||
:returns: list of Northbound DB connection strings
|
||||
:rtype: List[str]
|
||||
"""
|
||||
return itertools.chain(
|
||||
self.db_connection_strs((self.cluster_local_addr,),
|
||||
self.db_nb_port),
|
||||
self.db_connection_strs(self.cluster_remote_addrs,
|
||||
self.db_nb_port))
|
||||
|
||||
@property
|
||||
def db_sb_connection_strs(self):
|
||||
"""Return list of Southbound DB connection strings.
|
||||
|
||||
We override the parent property because for the peer relation
|
||||
``cluster_remote_addrs`` does not contain self.
|
||||
|
||||
:returns: list of Southbound DB connection strings
|
||||
:rtype: List[str]
|
||||
"""
|
||||
return itertools.chain(
|
||||
self.db_connection_strs((self.cluster_local_addr,),
|
||||
self.db_sb_port),
|
||||
self.db_connection_strs(self.cluster_remote_addrs,
|
||||
self.db_sb_port))
|
||||
|
||||
@when('endpoint.{endpoint_name}.joined')
|
||||
def joined(self):
|
||||
super().joined()
|
||||
|
Loading…
x
Reference in New Issue
Block a user