edelight/chef-mongodb

Replicaset configuration when all original instances are replaced?

gswallow opened this issue · 0 comments

Hi,

I am working on restoring a replicaset from EBS snapshot. When I bring up three new instances with Chef, I hit line 101 of libraries/mongodb.rb, which doesn't match the error message. My returned error message is:

"local.oplog.rs is not empty on the initiating member. cannot initiate."

None of the IP addresses of the new MongoDB servers are the same as they were, previously, because I'm restoring volumes from snapshot. Therefore, if I create a new config document containing the new hostnames and pass it in through rs.reconfig, my replica set comes up.

If I modify line 101:

elsif result.fetch('errmsg', nil) =~ /(\S+) is already initiated/ || (result.fetch('errmsg', nil) == 'already initialized') || (result.fetch('errmsg', nil) =~ /is not empty on the initiating member/)

Then Chef will do this for me, but I'm not sure that it's safe? I'll submit a pull request if it is.

Thanks!