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

Puppet execution hangs when mongo in a bad state

Open bekarau opened this issue 7 years ago • 0 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.3.3
  • Ruby: 2.4.2p198
  • Distribution: RHEL7.4
  • Module version: v1.1.0

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

  class { '::mongodb::globals':
    server_package_name => 'mongodb-org-server',
    client_package_name => 'mongodb-org-shell',
    mongos_package_name => 'mongodb-org-mongos',
    bind_ip             => [ '0.0.0.0' ],
  }
  class { '::mongodb::server':
    auth            => true,
    verbose         => false,
    nohttpinterface => true,
    replset         => "logs-repl",
    replset_members => ['mongodb1', 'mongodb2'],
    keyfile         => '/etc/mongodb-keyfile',
    key             => ...,
    create_admin    => ...admin,
    admin_password  => ...ass,
    store_creds     => true,
  }
  class { '::mongodb::client': }

What are you seeing

Puppet agent execution is failing outright with the error below.

What behaviour did you expect instead

I would expect Puppet to show a warning and continue with applying the remainder of a policy if it cannot connect to a mongo instance or fail to retrieve a related fact.

Output log

Error: Failed to apply catalog: Could not evaluate MongoDB shell command: printjson(db.getMongo().getDBs())

Any additional information you'd like to impart

Stumbled across this whilst trying to update an unrelated module on a mongo server. The mongo service was in a recovering state, so the mongo shell commands weren't returning. Stopping the mongod service and/or moving the .mongorc.js aside failed to persuade the policy to continue.

bekarau avatar Apr 24 '18 07:04 bekarau