Skip to content

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

@tsgoff

Description

@tsgoff

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?

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