@@ -106,6 +106,8 @@ def finish_cluster(names):
106
106
# The node in <name> is primed
107
107
# http://docs.couchdb.org/en/stable/cluster/setup.html
108
108
109
+ headers = {'Content-type' : 'application/json' }
110
+
109
111
# action: enable_cluster
110
112
payload = {}
111
113
payload ['action' ] = 'enable_cluster'
@@ -117,7 +119,9 @@ def finish_cluster(names):
117
119
payload ['remote_node' ] = name
118
120
payload ['remote_current_user' ] = creds [0 ]
119
121
payload ['remote_current_password' ] = creds [1 ]
120
- setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds )
122
+ setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds , headers = headers )
123
+ payload ['password' ] = "**masked**"
124
+ payload ['remote_current_password' ] = "**masked**"
121
125
print ("POST to http://127.0.0.1:5984/_cluster_setup returned" ,setup_resp .status_code ,"payload=" ,json .dumps (payload ))
122
126
123
127
# action: add_node
@@ -127,7 +131,8 @@ def finish_cluster(names):
127
131
payload ['password' ] = creds [1 ]
128
132
payload ['port' ] = 5984
129
133
payload ['host' ] = name
130
- setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds )
134
+ setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds , headers = headers )
135
+ payload ['password' ] = "**masked**"
131
136
print ("POST to http://127.0.0.1:5984/_cluster_setup returned" ,setup_resp .status_code ,"payload=" ,json .dumps (payload ))
132
137
133
138
print ('CouchDB cluster peer {} added to "setup coordination node"' .format (name ))
@@ -145,14 +150,17 @@ def finish_cluster(names):
145
150
def enable_cluster (nr_of_peers ):
146
151
creds = (os .getenv ("COUCHDB_USER" ), os .getenv ("COUCHDB_PASSWORD" ))
147
152
if creds [0 ] and creds [1 ]:
153
+ headers = {'Content-type' : 'application/json' }
154
+
148
155
# http://docs.couchdb.org/en/stable/cluster/setup.html
149
156
payload = {}
150
157
payload ['action' ] = 'enable_cluster'
151
158
payload ['bind_address' ] = '0.0.0.0'
152
159
payload ['username' ] = creds [0 ]
153
160
payload ['password' ] = creds [1 ]
154
- payload ['node_count' ] = nr_of_peers
155
- setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds )
161
+ payload ['node_count' ] = '{0}' .format (nr_of_peers )
162
+ setup_resp = requests .post ("http://127.0.0.1:5984/_cluster_setup" , json .dumps (payload ), auth = creds , headers = headers )
163
+ payload ['password' ] = "**masked**"
156
164
print ("POST to http://127.0.0.1:5984/_cluster_setup returned" ,setup_resp .status_code ,"payload=" ,json .dumps (payload ))
157
165
158
166
def sleep_forever ():
0 commit comments