Skip to content

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

@bimcas

Description

@bimcas
  • Puppet: 6.22.1
  • Ruby: 2.5.9p229
  • Distribution: CentOS 7.8.2003
  • Module version: 3.1.0
  • MongoDB: 4.2.14

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions