Closed tsgoff closed 7 months ago
ln -s mongosh /usr/bin/mongo
)DeprecationWarning: .setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead
fix (?): use db.getMongo().setReadPref("secondaryPreferred")
- mongo cli renamed to mongosh, provider should call this binary (workaround:
ln -s mongosh /usr/bin/mongo
)- rs.secondaryOk() calls, return:
DeprecationWarning: .setSecondaryOk() is deprecated. Use .setReadPref("primaryPreferred") instead
fix (?): usedb.getMongo().setReadPref("secondaryPreferred")
In version 5 are both mongo cli and mongosh installed. In version 6 you cannot install mongo cli. A symlink does not work because the output is different.
ln -s mongosh /usr/bin/mongo
kinda works for me on 6. Also symlink the mongosh config. So i can get around the errors above.. but it leads to new errors.
While the db can be finally configured via cmdline to work around the module issues.. puppet won't run at least for replset.
Error: Could not prefetch mongodb_replset provider 'mongo': 765: unexpected token at '{
_id: 'rsxxx',
version: 5,
term: 1,
members: [
{
Would love to get some module updates to support mongosh and 6.X out of the box.
https://github.com/voxpupuli/puppet-mongodb/pull/677 This PR only uses mongosh, and works on redhat for now for mongodb 6.x version. Still work in process.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
mongodb_version.rb: mongodb_version = Facter::Core::Execution.execute('mongo --version 2>&1') is_master.rb: Facter::Core::Execution.exec("mongo --quiet #{options} --eval \"#{e}printjson(db.adminCommand({ ping: 1 }))\"")
replset_spec.rb: on hosts_as('slave'), %{mongo test --verbose --eval 'load("/root/.mongorc.js");try { rs.secondaryOk() } catch (err) { rs.slaveOk() };printjson(db.dummyData.findOne())'}
What behaviour did you expect instead
Output log
Any additional information you'd like to impart
The old mongo cli is used in the ruby scripts to configure the mongo db. The outputs of mongosh are not compatible with the expected outputs. What would be the suggested way to adjust this? Rework all scripts to work with mongosh output and implement a condition for version > 5.0.9?