Skip to content

Commit c2066d5

Browse files
authored
Merge pull request #446 from vrtdev/feature/slaveok_replicaset
Add rs.slaveOk() to run before the getDBs call.
2 parents 79e3643 + b87a926 commit c2066d5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/puppet/provider/mongodb_database/mongodb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def self.instances
88
require 'json'
9-
dbs = JSON.parse mongo_eval('printjson(db.getMongo().getDBs())')
9+
dbs = JSON.parse mongo_eval('rs.slaveOk();printjson(db.getMongo().getDBs())')
1010

1111
dbs['databases'].map do |db|
1212
new(name: db['name'],

spec/unit/puppet/provider/mongodb_database/mongodb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
tmp = Tempfile.new('test')
3939
mongodconffile = tmp.path
4040
allow(provider.class).to receive(:mongod_conf_file).and_return(mongodconffile)
41-
provider.class.stubs(:mongo_eval).with('printjson(db.getMongo().getDBs())').returns(raw_dbs)
41+
provider.class.stubs(:mongo_eval).with('rs.slaveOk();printjson(db.getMongo().getDBs())').returns(raw_dbs)
4242
allow(provider.class).to receive(:db_ismaster).and_return(true)
4343
end
4444

0 commit comments

Comments
 (0)