Skip to content

Commit

Permalink
Merge pull request #84 from chuckbutler/connection-string-fix-rebase
Browse files Browse the repository at this point in the history
Cluster string logic fix
  • Loading branch information
mbruzek committed Mar 23, 2017
2 parents b3faa03 + 1d9e1ba commit 0e0979f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions reactive/etcd.py
Expand Up @@ -174,13 +174,18 @@ def send_cluster_connection_details(cluster, db):
key = read_tls_cert('client.key')
ca = read_tls_cert('ca.crt')
etcdctl = EtcdCtl()
bag = EtcdDatabag()

# Set the key, cert, and ca on the db relation
db.set_client_credentials(key, cert, ca)

port = hookenv.config().get('port')
# Get all the peers participating in the cluster relation.
members = cluster.get_peer_addresses()
# Append our own address to the membership list, because peers dont self
# actualize
members.append(bag.private_address)
members.sort()
# Create a connection string with all the members on the configured port.
connection_string = get_connection_string(members, port)
# Set the connection string on the db relation.
Expand All @@ -189,6 +194,7 @@ def send_cluster_connection_details(cluster, db):

@when('db.connected')
@when('etcd.ssl.placed')
@when_not('cluster.joined')
def send_single_connection_details(db):
''' '''
cert = read_tls_cert('client.crt')
Expand Down

0 comments on commit 0e0979f

Please sign in to comment.