Skip to content

Commit e67f403

Browse files
author
Johan De Wit
committed
adjust errormessage to new error messages
1 parent f466e44 commit e67f403

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/puppet/provider/mongodb_replset/mongo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def get_hosts_status(members)
161161
status = rs_status(host)
162162
raise Puppet::Error, "Can't configure replicaset #{name}, host #{host} is not supposed to be part of a replicaset." if status.key?('errmsg') && status['errmsg'] == 'not running with --replSet'
163163

164-
if auth_enabled && status.key?('errmsg') && (status['errmsg'].include?('unauthorized') || status['errmsg'].include?('not authorized') || status['errmsg'].include?('requires authentication'))
164+
if auth_enabled && status.key?('errmsg') && (status['errmsg'].include?('requires authentication') || status['errmsg'].include?('requires authentication') || status['errmsg'].include?('requires authentication'))
165165
Puppet.warning "Host #{host} is available, but you are unauthorized because of authentication is enabled: #{auth_enabled}"
166166
alive.push(member)
167167
end

lib/puppet/provider/mongodb_user/mongodb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ def self.instances
1212
if db_ismaster
1313
script = 'printjson(db.system.users.find().toArray())'
1414
# A hack to prevent prefetching failures until admin user is created
15-
script = "try {#{script}} catch (e) { if (e.message.match(/not authorized on admin/)) { 'not authorized on admin' } else {throw e}}" if auth_enabled
15+
script = "try {#{script}} catch (e) { if (e.message.match(/requires authentication/)) { 'not authorized on admin' } else {throw e}}" if auth_enabled
1616

1717
out = mongo_eval(script)
1818

19-
return [] if auth_enabled && out.include?('not authorized on admin')
19+
return [] if auth_enabled && out.include?('requires authentication')
2020

2121
users = JSON.parse out
2222

0 commit comments

Comments
 (0)