Skip to content

Commit d203c12

Browse files
committed
Look at all active hosts to detect if replset init is successfully ended
1 parent 97d2fd1 commit d203c12

File tree

1 file changed

+7
-7
lines changed
  • lib/puppet/provider/mongodb_replset

1 file changed

+7
-7
lines changed

lib/puppet/provider/mongodb_replset/mongo.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@ def create_replica_set(alive_hosts)
284284
retry_sleep = 3
285285

286286
retry_limit.times do |n|
287-
if db_ismaster(alive_hosts[0]['host'])['ismaster']
288-
Puppet.debug 'Replica set initialization has successfully ended'
289-
return true
290-
else
291-
Puppet.debug "Waiting for replica initialization. Retry: #{n}"
292-
sleep retry_sleep
293-
next
287+
alive_hosts.each do |alive_host|
288+
if db_ismaster(alive_host['host'])['ismaster']
289+
Puppet.debug 'Replica set initialization has successfully ended'
290+
return true
291+
end
294292
end
293+
Puppet.debug "Waiting for replica initialization. Retry: #{n}"
294+
sleep retry_sleep
295295
end
296296
raise Puppet::Error, "rs.initiate() failed for replicaset #{name}"
297297
end

0 commit comments

Comments
 (0)