Skip to content

Commit

Permalink
SIRE-9538 complete removing x509 and fix rubocop tests
Browse files Browse the repository at this point in the history
Reviewed-by: muspelkat
  • Loading branch information
Henning-B committed Jun 20, 2023
1 parent 5af5abb commit 030081d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
11 changes: 1 addition & 10 deletions lib/puppet/provider/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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'],
Expand Down
5 changes: 2 additions & 3 deletions lib/puppet/provider/mongodb_database/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def self.instances
require 'json'

pre_cmd='
pre_cmd = '
try {
version=parseInt(db.version().split(\'.\')[0])
if (version>=5){
Expand All @@ -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)
Expand Down

0 comments on commit 030081d

Please sign in to comment.