Skip to content

Commit

Permalink
Fix first run error on secondaries
Browse files Browse the repository at this point in the history
  • Loading branch information
guikcd committed Feb 17, 2020
1 parent e432637 commit 3faf455
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/mongodb_database/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def self.instances
require 'json'
dbs = JSON.parse mongo_eval('printjson(db.getMongo().getDBs())')
dbs = JSON.parse mongo_eval('rs.slaveOk();printjson(db.getMongo().getDBs())')

dbs['databases'].collect do |db|
new(:name => db['name'],
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/mongodb_database/mongodb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
tmp = Tempfile.new('test')
@mongodconffile = tmp.path
allow(provider.class).to receive(:get_mongod_conf_file).and_return(@mongodconffile)
provider.class.stubs(:mongo_eval).with('printjson(db.getMongo().getDBs())').returns(raw_dbs)
provider.class.stubs(:mongo_eval).with('rs.slaveOk();printjson(db.getMongo().getDBs())').returns(raw_dbs)
allow(provider.class).to receive(:db_ismaster).and_return(true)
end

Expand Down

0 comments on commit 3faf455

Please sign in to comment.