-
-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Could not prefetch mongodb_replset provider 'mongo': 765: unexpected token at 'WARNING: ) is deprecated and may be removed in the next major release. Please use secondaryOk() #612
Comments
|
I've got a similar issue on Ubuntu 20.04 LTS, with module v3.1.0, Puppet 6 on a new deployment (clean VM): |
|
It appears that the current usage of I've no objection to creating a PR to swap out lib/puppet/provider/mongodb_database/mongodb.rb: 7 def self.instances
8 require 'json'
9: dbs = JSON.parse mongo_eval('rs.slaveOk();printjson(db.getMongo().getDBs())')
10
11 dbs['databases'].map do |db|spec/acceptance/replset_spec.rb: 68 it 'checks the data on the slave' do
69 sleep(10)
70: on hosts_as('slave'), %{mongo --verbose --eval 'rs.slaveOk(); printjson(db.test.findOne({name:"test1"}))'} do |r|
71 expect(r.stdout).to match %r{some value}
72 end
..
199 it 'checks the data on the slave' do
200 sleep(10)
201: on hosts_as('slave'), %{mongo test --verbose --eval 'load("/root/.mongorc.js");rs.slaveOk();printjson(db.dummyData.findOne())'} do |r|
202 expect(r.stdout).to match %r{created_by_puppet}
203 endspec/unit/puppet/provider/mongodb_database/mongodb_spec.rb: 37 mongodconffile = tmp.path
38 allow(provider.class).to receive(:mongod_conf_file).and_return(mongodconffile)
39: allow(provider.class).to receive(:mongo_eval).with('rs.slaveOk();printjson(db.getMongo().getDBs())').and_return(raw_dbs)
40 allow(provider.class).to receive(:db_ismaster).and_return(true)
41 endtemplates/mongorc.js.erb: 28 try {
29 <% if @replset -%>
30: rs.slaveOk()
31 <% end -%>
32 var prev_db = db |
|
@bimcas FYI, I believe this is fixed with what's currently in |
|
@cmseal Thanks for your response. _Notice: /Stage[main]/Mongodb::Server::Config/File[/root/.mongorc.js]/content: if (authRequired()) { So, as you see puppet by itself restore my correct setting rs.secondaryOk() to rs.slaveOk() again, and of course I'm again getting the message: What exact version and commit of mongo module I should use to fix this issue? |
|
Problem has gone when I'm start using module with commit a59b99e. No more such issues. |
When I run puppet on the MongoDB node (mongo service is running) I'm getting the message:
Error: Could not prefetch mongodb_replset provider 'mongo': 765: unexpected token at 'WARNING: ) is deprecated and may be removed in the next major release. Please use secondaryOk() instead of slaveOk()
I see such content in mongorc.js file after the puppet was run:
if (authRequired()) {
try {
rs.slaveOk()
var prev_db = db
db = db.getSiblingDB('admin')
db.auth('admin', 'xxxxxxxxxxxxx')
db = db.getSiblingDB(prev_db)
}
catch (err) {
// This isn't catching authentication errors as I'd expect...
abort('Unknown error')
}
}
So, it seems that the previous fix (link 80f47d5) to use rs.secondaryOk() on versions that deprecated rs.slaveOk() isn't working.
How we can solve this issue?
The text was updated successfully, but these errors were encountered: