Skip to content

Commit

Permalink
re-enable master check
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan De Wit committed Jul 5, 2023
1 parent 65e2ad3 commit 2bec03b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/puppet/provider/mongodb_user/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2bec03b

Please sign in to comment.