diff --git a/lib/puppet/provider/mongodb.rb b/lib/puppet/provider/mongodb.rb index 3c2782c17..d459dffd0 100644 --- a/lib/puppet/provider/mongodb.rb +++ b/lib/puppet/provider/mongodb.rb @@ -28,15 +28,6 @@ def self.mongod_conf_file def self.mongo_conf config = YAML.load_file(mongod_conf_file) || {} - # determine if we need the tls for connecion or client - _tlscert = if config['setParameter'] && config['setParameter']['authenticationMechanisms'] == 'MONGODB-X509' - mongosh_config = YAML.load_file('/root/.mongosh.yaml') || {} - if mongosh_config['admin'] && mongosh_config['admin']['tlsCertificateKeyFile'] - mongosh_config['admin']['tlsCertificateKeyFile'] - else - config['net.tls.certificateKeyFile'] - end - end { 'bindip' => config['net.bindIp'], 'port' => config['net.port'], @@ -47,7 +38,7 @@ def self.mongo_conf 'sslca' => config['net.ssl.CAFile'], 'tlsallowInvalidHostnames' => config['net.tls.allowInvalidHostnames'], 'tls' => config['net.tls.mode'], - 'tlscert' => _tlscert, + 'tlscert' => config['net.tls.certificateKeyFile'], 'tlsca' => config['net.tls.CAFile'], 'auth' => config['security.authorization'], 'shardsvr' => config['sharding.clusterRole'], diff --git a/lib/puppet/provider/mongodb_database/mongodb.rb b/lib/puppet/provider/mongodb_database/mongodb.rb index 8e165f65b..acf13646c 100644 --- a/lib/puppet/provider/mongodb_database/mongodb.rb +++ b/lib/puppet/provider/mongodb_database/mongodb.rb @@ -8,7 +8,7 @@ def self.instances require 'json' - pre_cmd=' + pre_cmd = ' try { version=parseInt(db.version().split(\'.\')[0]) if (version>=5){ @@ -22,11 +22,10 @@ def self.instances rs.slaveOk() } ' - mongo_eval_result=mongo_eval(pre_cmd + ';JSON.stringify(db.getMongo().getDBs())') + mongo_eval_result = mongo_eval(pre_cmd + ';JSON.stringify(db.getMongo().getDBs())') pp mongo_eval_result dbs = JSON.parse mongo_eval_result - dbs['databases'].map do |db| new(name: db['name'], ensure: :present)