Skip to content

Commit

Permalink
Set dbpath_fix to false by default
Browse files Browse the repository at this point in the history
Under Xenial, the current default value of dbpath_fix set to true leads
to idempotency issues because the data files may be created with the
nogroup group.  This can lead to puppet repeatedly fixing permissions
which is not ideal. The files that are getting changed are set to 0600
so the group ownership does not help.  By default, we should be setting
this to false because we should not need to manage the user/group
permissions with the default install provided by distrobutions.
  • Loading branch information
mwhahaha committed Oct 3, 2017
1 parent a66a7cd commit f99c25c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ for your OS distro.
Set this value to designate a directory for the mongod instance to store
it's data. If not specified, the module will use the default for your OS distro.

##### `dbpath_fix`
Set this value to true if you want puppet to recursively manage the permissions
of the files in the dbpath directory. If you are using the default dbpath, this
should probably be false. Set this to true if you are using a custom dbpath. The
default is false.

##### `pidfilepath`
Specify a file location to hold the PID or process ID of the mongod process.
If not specified, the module will use the default for your OS distro.
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$handle_creds = true
$store_creds = false
$rcfile = "${::root_home}/.mongorc.js"
$dbpath_fix = true
$dbpath_fix = false

$mongos_service_manage = pick($mongodb::globals::mongos_service_manage, true)
$mongos_service_enable = pick($mongodb::globals::mongos_service_enable, true)
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/server_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,15 @@
it { is_expected.to contain_file('/var/run/mongodb/mongod.pid').with_mode('0640') }
end

describe 'with dbpath_fix enabled' do
let(:pre_condition) { "class { 'mongodb::server': config => '/etc/mongod.conf', dbpath => '/var/lib/mongo', rcfile => '/root/.mongorc.js', dbpath_fix => true, user => 'foo', group => 'bar' }" }

it { is_expected.to contain_exec('fix dbpath permissions').with(
:command => 'chown -R foo:bar /var/lib/mongo',
:path => ['/usr/bin', '/bin'],
:onlyif => "find /var/lib/mongo -not -user foo -o -not -group bar -print -quit | grep -q '.*'",
:subscribe => "File[/var/lib/mongo]")
}
end

end

0 comments on commit f99c25c

Please sign in to comment.