From 2bec03b69412662441ba6dc5d5abb5aabf8e95da Mon Sep 17 00:00:00 2001 From: Johan De Wit Date: Wed, 5 Jul 2023 18:31:44 +0200 Subject: [PATCH] re-enable master check --- lib/puppet/provider/mongodb_user/mongodb.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/mongodb_user/mongodb.rb b/lib/puppet/provider/mongodb_user/mongodb.rb index e7b54fcb1..9094c7ad1 100644 --- a/lib/puppet/provider/mongodb_user/mongodb.rb +++ b/lib/puppet/provider/mongodb_user/mongodb.rb @@ -11,7 +11,7 @@ def self.instances Puppet.debug("MONGODB_USER self.instances") - #if db_ismaster + if db_ismaster script = 'EJSON.stringify(db.system.users.find().toArray())' # A hack to prevent prefetching failures until admin user is created script = "try {#{script}} catch (e) { if (e.message.match(/requires authentication/) || e.message.match(/not authorized on admin/)) { 'not authorized on admin' } else {throw e}}" if auth_enabled @@ -41,10 +41,10 @@ def self.instances password_hash: user['credentials']['MONGODB-CR'], scram_credentials: user['credentials']['SCRAM-SHA-1']) end - #else - # Puppet.warning 'User info is available only from master host' - # [] - #end + else + Puppet.warning 'User info is available only from master host' + [] + end end # Assign prefetched users based on username and database, not on id and name