@@ -157,28 +157,29 @@ def finish_cluster(names):
157
157
remote_resp = requests .get (remote_membership_uri , auth = creds )
158
158
print ("Node {0} has all node members in place!" .format (name ))
159
159
160
-
161
160
print ('CouchDB cluster peer {} added to "setup coordination node"' .format (name ))
162
161
# At this point ALL peers have _nodes populated. Finish the cluster setup!
162
+
163
+ print ("== Creating default databases ===" )
164
+ setup_resp = requests .put ("http://127.0.0.1:5984/_users" , auth = creds )
165
+ print ("\t Request: PUT http://127.0.0.1:5984/_users" )
166
+ print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
167
+
168
+ setup_resp = requests .put ("http://127.0.0.1:5984/_replicator" , auth = creds )
169
+ print ("\t Request: PUT http://127.0.0.1:5984/_replicator" )
170
+ print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
171
+
172
+ setup_resp = requests .put ("http://127.0.0.1:5984/_global_changes" , auth = creds )
173
+ print ("\t Request: PUT http://127.0.0.1:5984/_global_changes" )
174
+ print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
175
+
163
176
setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json = {"action" : "finish_cluster" }, auth = creds )
164
177
if (setup_resp .status_code == 201 ):
165
178
print ("== CouchDB cluster setup done! ===" )
166
- setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" )
167
- print ("CouchDB cluster setup done." )
168
- print ("\t Request: GET http://127.0.0.1:5984/_cluster_setup" )
169
- print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
170
- print ("== Creating default databases ===" )
171
-
172
- setup_resp = requests .put ("http://127.0.0.1:5984/_users" , auth = creds , headers = headers )
173
- print ("\t Request: PUT http://127.0.0.1:5984/_users" )
179
+ print ('\t Request: POST http://127.0.0.1:5984/_cluster_setup , payload {"action": "finish_cluster"}' )
174
180
print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
175
-
176
- setup_resp = requests .put ("http://127.0.0.1:5984/_replicator" , auth = creds , headers = headers )
177
- print ("\t Request: PUT http://127.0.0.1:5984/_replicator" )
178
- print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
179
-
180
- setup_resp = requests .put ("http://127.0.0.1:5984/_global_changes" , auth = creds , headers = headers )
181
- print ("\t Request: PUT http://127.0.0.1:5984/_global_changes" )
181
+ setup_resp = requests .get ("http://127.0.0.1:5984/_cluster_setup" , auth = creds )
182
+ print ('\t Request: GET http://127.0.0.1:5984/_cluster_setup' )
182
183
print ("\t \t Response:" , setup_resp .status_code , setup_resp .json ())
183
184
184
185
print ("Time to relax!" )
@@ -199,7 +200,6 @@ def sleep_forever():
199
200
connect_the_dots (peer_names )
200
201
print ('Cluster membership populated!' )
201
202
if (os .getenv ("COUCHDB_USER" ) and os .getenv ("COUCHDB_PASSWORD" )):
202
- enable_cluster (len (peer_names ))
203
203
finish_cluster (peer_names )
204
204
else :
205
205
print ('Skipping cluster setup. Username and/or password not provided' )
0 commit comments