puppet-mongodb icon indicating copy to clipboard operation
puppet-mongodb copied to clipboard

removed mongo cli in 6.0 is not compatible with outputs from new mongosh

Open tsgoff opened this issue 3 years ago • 0 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Distribution: 6.0
  • Module version: v.4.1.1

How to reproduce (e.g Puppet code you use)

  class { '::mongodb::globals':
    manage_package_repo => true,
    version             => '6.0.0',
  }

What are you seeing

Error: /Stage[main]/Mongodb::Replset/Mongodb_replset[mongodb.int]: Could not evaluate: Can't connect to any member of replicaset mongodb.int.
Error: Failed to apply catalog: Could not evaluate MongoDB shell command: load('/root/.mongorc.js'); try { rs.secondaryOk() } catch (err) { rs.slaveOk() };printjson(db.getMongo().getDBs())

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?

tsgoff avatar Jul 28 '22 17:07 tsgoff