@@ -114,7 +114,7 @@ def are_nodes_in_sync(names):
114
114
local_resp = requests .get (local_membership_uri )
115
115
116
116
# If any difference is found - set to true
117
- is_different = False
117
+ not_ready = False
118
118
119
119
# Step through every peer. Ensure they are "ready" before progressing.
120
120
for name in names :
@@ -127,18 +127,20 @@ def are_nodes_in_sync(names):
127
127
128
128
if len (names ) < 2 :
129
129
# Minimum 2 nodes to form cluster!
130
- is_different = True
130
+ not_ready = True
131
+ print ("\t Need at least 2 DNS records to start with. Got " ,len (names ))
131
132
132
133
# Compare local and remote _mebership data. Make sure the set
133
134
# of nodes match. This will ensure that the remote nodes
134
135
# are fully primed with nodes data before progressing with
135
136
# _cluster_setup
136
137
if (remote_resp .status_code == 200 ) and (local_resp .status_code == 200 ):
137
- if len (local_resp .json ()) < 2 :
138
+ if len (local_resp .json ()[ 'cluster_nodes' ] ) < 2 :
138
139
# Minimum 2 nodes to form cluster!
139
- is_different = True
140
+ not_ready = True
141
+ print ("\t Need at least 2 cluster nodes in the _membership of pod" ,os .getenv ("HOSTNAME" ))
140
142
if ordered (local_resp .json ()) != ordered (remote_resp .json ()):
141
- is_different = True
143
+ not_ready = True
142
144
143
145
# For logging only...
144
146
records_in_local_but_not_in_remote = set (local_resp .json ()['cluster_nodes' ]) - set (remote_resp .json ()['cluster_nodes' ])
@@ -148,8 +150,8 @@ def are_nodes_in_sync(names):
148
150
if records_in_remote_but_not_in_local :
149
151
print ("\t Cluster members in {0} not yet present in {1}: {2}" .format (name .split ("." ,1 )[0 ], os .getenv ("HOSTNAME" ), records_in_remote_but_not_in_local ))
150
152
else :
151
- is_different = True
152
- return not is_different
153
+ not_ready = True
154
+ return not not_ready
153
155
154
156
def sleep_forever ():
155
157
while True :
0 commit comments