Module: Mink::ManagerHelper
- Included in:
- ReplSetManager, ShardingManager
- Defined in:
- lib/mink/helpers/manager_helper.rb
Instance Method Summary collapse
- #attempt ⇒ Object
- #get_path(name) ⇒ Object
- #kill_existing_mongods ⇒ Object
- #kill_existing_mongos ⇒ Object
- #kill_pidlist(pids) ⇒ Object
Instance Method Details
#attempt ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mink/helpers/manager_helper.rb', line 8 def attempt raise "No block given!" unless block_given? count = 0 begin return yield rescue Mongo::OperationFailure, Mongo::ConnectionFailure => ex sleep(1) count += 1 retry if count < 60 end raise ex end |
#get_path(name) ⇒ Object
4 5 6 |
# File 'lib/mink/helpers/manager_helper.rb', line 4 def get_path(name) File.join(@working_dir, name) end |
#kill_existing_mongods ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/mink/helpers/manager_helper.rb', line 22 def kill_existing_mongods if File.exists?(@pidlistfile) pids = YAML.load(File.open(@pidlistfile, "r").read) kill_pidlist(pids) else system("killall mongod") end end |
#kill_existing_mongos ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/mink/helpers/manager_helper.rb', line 31 def kill_existing_mongos if File.exists?(@pidlistfile) pids = YAML.load(File.open(@pidlistfile, "r").read) kill_pidlist(pids) else system("killall mongos") end end |
#kill_pidlist(pids) ⇒ Object
40 41 42 43 44 |
# File 'lib/mink/helpers/manager_helper.rb', line 40 def kill_pidlist(pids) pids.each do |pid| system("kill -9 #{pid}") end end |