Skip to content

Commit bb41b60

Browse files
author
Maksim Fedotov
committed
support for yaml in mongodb.cfg
1 parent a8a5857 commit bb41b60

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/puppet/provider/mongodb.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ def self.mongod_conf_file
2828
def self.mongo_conf
2929
config = YAML.load_file(mongod_conf_file) || {}
3030
{
31-
'bindip' => config['net.bindIp'],
32-
'port' => config['net.port'],
33-
'ipv6' => config['net.ipv6'],
34-
'allowInvalidHostnames' => config['net.ssl.allowInvalidHostnames'],
35-
'ssl' => config['net.ssl.mode'],
36-
'sslcert' => config['net.ssl.PEMKeyFile'],
37-
'sslca' => config['net.ssl.CAFile'],
38-
'auth' => config['security.authorization'],
39-
'shardsvr' => config['sharding.clusterRole'],
40-
'confsvr' => config['sharding.clusterRole']
31+
'bindip' => config['net.bindIp'] || config.fetch('net', {}).fetch('bindIp', nil),
32+
'port' => config['net.port'] || config.fetch('net', {}).fetch('port', nil),
33+
'ipv6' => config['net.ipv6'] || config.fetch('net', {}).fetch('ipv6', nil),
34+
'allowInvalidHostnames' => config['net.ssl.allowInvalidHostnames'] || config.fetch('net', {}).fetch('ssl', {}).fetch('allowInvalidHostnames', nil),
35+
'ssl' => config['net.ssl.mode'] || config.fetch('net', {}).fetch('ssl', {}).fetch('mode', nil),
36+
'sslcert' => config['net.ssl.PEMKeyFile'] || config.fetch('net', {}).fetch('ssl', {}).fetch('PEMKeyFile', nil),
37+
'sslca' => config['net.ssl.CAFile'] || config.fetch('net', {}).fetch('ssl', {}).fetch('CAFile', nil),
38+
'auth' => config['security.authorization'] || config.fetch('security', {}).fetch('authorization', nil),
39+
'shardsvr' => config['sharding.clusterRole'] || config.fetch('sharding',{}).fetch('clusterRole', nil),
40+
'confsvr' => config['sharding.clusterRole'] || config.fetch('sharding', {}).fetch('clusterRole', nil)
4141
}
4242
end
4343

0 commit comments

Comments
 (0)