minor: improvements to ReplSetManager

add_node can now take blocks
new add_arbiter method
This commit is contained in:
Tyler Brock 2012-02-18 15:00:25 -05:00
parent 95d1129e75
commit b9371206dc
1 changed files with 8 additions and 2 deletions

View File

@ -155,11 +155,11 @@ class ReplSetManager
return secondary
end
def add_node(n=nil)
def add_node(n=nil, &block)
primary = get_node_with_state(1)
con = get_connection(primary)
init_node(n || @mongods.length)
init_node(n || @mongods.length, &block)
config = con['local']['system.replset'].find_one
@config['version'] = config['version'] + 1
@ -173,6 +173,12 @@ class ReplSetManager
ensure_up
end
def add_arbiter
add_node do |attrs|
attrs['arbiterOnly'] = true
end
end
def wait_for_death(pid)
@retries.times do
if `ps a | grep mongod`.include?("#{pid}")