Skip to content

Commit 3ad17e1

Browse files
author
Robert Gartman
committed
Automate _cluster_setup
1 parent fd53bf1 commit 3ad17e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mem3_helper.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def finish_cluster(names):
9898
print ("=== Adding nodes to CouchDB cluster via the “setup coordination node” ===")
9999
for name in names:
100100
# Exclude "this" pod
101-
if (name.split(".", 1) != os.getenv("HOSTNAME")):
101+
if (name.split(".",1)[0]) != os.getenv("HOSTNAME")):
102102
# action: enable_cluster
103103
payload = {}
104104
payload['action'] = 'enable_cluster'
@@ -194,6 +194,8 @@ def sleep_forever():
194194
if __name__ == '__main__':
195195
peer_names = discover_peers(construct_service_record())
196196
print("Got the following peers' fqdm from DNS lookup:",peer_names,flush=True)
197+
if (os.getenv("COUCHDB_USER") and os.getenv("COUCHDB_PASSWORD")):
198+
enable_cluster(len(peer_names))
197199
connect_the_dots(peer_names)
198200
print('Cluster membership populated!')
199201
if (os.getenv("COUCHDB_USER") and os.getenv("COUCHDB_PASSWORD")):

0 commit comments

Comments
 (0)