File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
- # This file grabs the list of pod names behind the headless service
2
- # called "couchdb" and feeds those as `couchdb@HOSTNAME` nodes to mem3.
1
+ """Helper module to connect a CouchDB Kube StatefulSet
2
+
3
+ This script grabs the list of pod names behind the headless service
4
+ associated with our StatefulSet and feeds those as `couchdb@FQDN`
5
+ nodes to mem3.
6
+ """
3
7
4
8
import json
5
9
import requests
@@ -34,12 +38,12 @@ def connect_the_dots(names, retries=5):
34
38
uri = "http://127.0.0.1:5986/_nodes/couchdb@{0}" .format (name )
35
39
doc = {}
36
40
try :
37
- r = requests .put (uri , data = json .dumps (doc ))
38
- if r .status_code == 404 :
41
+ resp = requests .put (uri , data = json .dumps (doc ))
42
+ if resp .status_code == 404 :
39
43
print ('CouchDB nodes DB does not exist yet' )
40
44
time .sleep (5 )
41
45
connect_the_dots (names , retries - 1 )
42
- print (name , r .status_code )
46
+ print (name , resp .status_code )
43
47
except requests .exceptions .ConnectionError :
44
48
print ('CouchDB admin port not up yet' )
45
49
time .sleep (5 )
You can’t perform that action at this time.
0 commit comments